linux/drivers/staging/rtl8723bs
Arnd Bergmann c3a8f7dfc7 staging: rtl8723bs: convert strncpy to strscpy
gcc-9 complains about a possibly unterminated string in the strncpy() destination:

In function 'rtw_cfg80211_add_monitor_if',
    inlined from 'cfg80211_rtw_add_virtual_intf' at drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2209:9:
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2146:2: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
 2146 |  strncpy(mon_ndev->name, name, IFNAMSIZ);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This one is a false-positive because of the explicit termination in the following
line, and recent versions of clang and gcc no longer warn about this.

Interestingly, the other strncpy() in this file is missing a termination but
does not produce a warning, possibly because of the type confusion and the
cast between u8 and char.

Change both strncpy() instances to strscpy(), which avoids the warning as well
as the possibly missing termination. No additional padding is needed here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://github.com/KSPP/linux/issues/90
Reviewed-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20240408194821.3183462-2-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-09 17:53:50 +02:00
..
core Staging: rtl8723bs: Delete dead code from update_current_network() 2024-04-09 17:52:23 +02:00
hal staging: rtl8723bs: remove redundant variable hoffset 2024-03-05 14:05:17 +00:00
include staging: rtl8723bs: Use helpers to check broadcast and multicast Ether addresses 2023-08-22 15:47:17 +02:00
os_dep staging: rtl8723bs: convert strncpy to strscpy 2024-04-09 17:53:50 +02:00
Kconfig
Makefile staging: rtl8723bs: delete rtw_odm.c and rtw_odm.h 2022-09-09 09:49:47 +02:00
TODO