WSL2-Linux-Kernel/drivers/firmware/tegra
Arnd Bergmann 9294996f0b firmware: tegra: fix strncpy()/strncat() confusion
The way that bpmp_populate_debugfs_inband() uses strncpy()
and strncat() makes no sense since the size argument for
the first is insufficient to contain the trailing '/'
and the second passes the length of the input rather than
the output, which triggers a warning:

In function 'strncat',
    inlined from 'bpmp_populate_debugfs_inband' at ../drivers/firmware/tegra/bpmp-debugfs.c:422:4:
include/linux/string.h:289:30: warning: '__builtin_strncat' specified bound depends on the length of the source argument [-Wstringop-overflow=]
  289 | #define __underlying_strncat __builtin_strncat
      |                              ^
include/linux/string.h:367:10: note: in expansion of macro '__underlying_strncat'
  367 |   return __underlying_strncat(p, q, count);
      |          ^~~~~~~~~~~~~~~~~~~~
drivers/firmware/tegra/bpmp-debugfs.c: In function 'bpmp_populate_debugfs_inband':
include/linux/string.h:288:29: note: length computed here
  288 | #define __underlying_strlen __builtin_strlen
      |                             ^
include/linux/string.h:321:10: note: in expansion of macro '__underlying_strlen'
  321 |   return __underlying_strlen(p);

Simplify this to use an snprintf() instead.

Fixes: 5e37b9c137 ("firmware: tegra: Add support for in-band debug")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2020-11-10 20:15:17 +01:00
..
Kconfig firmware: tegra: Fix a typo in Kconfig 2020-02-17 08:54:09 +01:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
bpmp-debugfs.c firmware: tegra: fix strncpy()/strncat() confusion 2020-11-10 20:15:17 +01:00
bpmp-private.h firmware/tegra: Enable Tegra186 BPMP support on Tegra194 2019-02-07 18:52:39 +01:00
bpmp-tegra186.c firmware: tegra: Defer BPMP probe if shared memory not available 2020-05-22 14:57:14 +02:00
bpmp-tegra210.c firmware: tegra: add bpmp driver for Tegra210 2019-01-25 15:58:47 +01:00
bpmp.c firmware: tegra: Enable BPMP support on Tegra234 2020-09-18 15:57:04 +02:00
ivc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00