aboutsummaryrefslogtreecommitdiff
path: root/.cocciconfig
diff options
context:
space:
mode:
authorGravatar Justin Stitt <justinstitt@google.com> 2023-09-27 06:41:37 +0000
committerGravatar Ulf Hansson <ulf.hansson@linaro.org> 2023-09-27 12:15:17 +0200
commit4b9b94766534ea23bffc8606b73fb18501b49a67 (patch)
tree092a45cc418ef09204daba0cc12bcd554f1fa5aa /.cocciconfig
parentmmc: Merge branch fixes into next (diff)
downloadlinux-4b9b94766534ea23bffc8606b73fb18501b49a67.tar.gz
linux-4b9b94766534ea23bffc8606b73fb18501b49a67.tar.bz2
linux-4b9b94766534ea23bffc8606b73fb18501b49a67.zip
mmc: vub300: replace deprecated strncpy with strscpy
`strncpy` is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. We expect `vub300->vub_name` to be NUL-terminated based on its uses with format strings: | dev_info(&vub300->udev->dev, "using %s for SDIO offload processing\n", | vub300->vub_name); NUL-padding is not needed. We can see cleaning out vub_name simply consists of: | vub300->vub_name[0] = 0; Considering the above, for all 11 cases a suitable replacement is `strscpy` [2] due to the fact that it guarantees NUL-termination on the destination buffer without unnecessarily NUL-padding. To be clear, there is no existing bug in the current implementation as the string literals are all small enough as to not cause a buffer overread. Nonetheless, this gets us 11 steps closer to removing strncpy uses. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Justin Stitt <justinstitt@google.com> Link: https://lore.kernel.org/r/20230927-strncpy-drivers-mmc-host-vub300-c-v1-1-77426f62eef4@google.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to '.cocciconfig')
0 files changed, 0 insertions, 0 deletions