diff options
author | Kees Cook <keescook@chromium.org> | 2023-12-13 01:13:12 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-12-14 05:31:32 +0300 |
commit | 84cc99199a34ba894371041caacc95c2a03b3700 (patch) | |
tree | 832fd86fec6b70c5121d41ce42746b57d52a6eeb /drivers/net/ethernet/chelsio | |
parent | 97f265ef7f5b526b33d6030b2a1fc69a2259bf4a (diff) | |
download | linux-84cc99199a34ba894371041caacc95c2a03b3700.tar.xz |
amd-xgbe: Avoid potential string truncation in name
Build with W=1 were warning about a potential string truncation:
drivers/net/ethernet/amd/xgbe/xgbe-drv.c: In function 'xgbe_alloc_channels':
drivers/net/ethernet/amd/xgbe/xgbe-drv.c:211:73: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 8 [-Wformat-truncation=]
211 | snprintf(channel->name, sizeof(channel->name), "channel-%u", i);
| ^~
drivers/net/ethernet/amd/xgbe/xgbe-drv.c:211:64: note: directive argument in the range [0, 4294967294]
211 | snprintf(channel->name, sizeof(channel->name), "channel-%u", i);
| ^~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-drv.c:211:17: note: 'snprintf' output between 10 and 19 bytes into a destination of size 16
211 | snprintf(channel->name, sizeof(channel->name), "channel-%u", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Increase the size of the "name" buffer to handle the full format range.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202312100937.ZPZCARhB-lkp@intel.com/
Cc: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20231212221312.work.830-kees@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/chelsio')
0 files changed, 0 insertions, 0 deletions