aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_request.c
diff options
context:
space:
mode:
authorEric Dumazet <[email protected]>2024-04-08 08:28:43 +0000
committerJakub Kicinski <[email protected]>2024-04-10 00:00:16 +0000
commit6309863b31dd80317cd7d6824820b44e254e2a9c (patch)
tree5f85d74ace141ee9e7685ed521ce8c6166b37c7f /net/bluetooth/hci_request.c
parentipv4/route: avoid unused-but-set-variable warning (diff)
downloadkernel-6309863b31dd80317cd7d6824820b44e254e2a9c.tar.gz
kernel-6309863b31dd80317cd7d6824820b44e254e2a9c.zip
net: add copy_safe_from_sockptr() helper
copy_from_sockptr() helper is unsafe, unless callers did the prior check against user provided optlen. Too many callers get this wrong, lets add a helper to fix them and avoid future copy/paste bugs. Instead of : if (optlen < sizeof(opt)) { err = -EINVAL; break; } if (copy_from_sockptr(&opt, optval, sizeof(opt)) { err = -EFAULT; break; } Use : err = copy_safe_from_sockptr(&opt, sizeof(opt), optval, optlen); if (err) break; Signed-off-by: Eric Dumazet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/bluetooth/hci_request.c')
0 files changed, 0 insertions, 0 deletions