]> git.baikalelectronics.ru Git - kernel.git/commit
net: bonding: Use strscpy_pad() instead of manually-truncated strncpy()
authorKees Cook <keescook@chromium.org>
Wed, 2 Jun 2021 20:58:20 +0000 (13:58 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 Jun 2021 21:16:14 +0000 (14:16 -0700)
commitbb246c26906c5e7f00e68f9792f3dce7bfd2bbcd
tree203969b734ff7f3a4ea0fe55383cc2d8bc431712
parent65dff9616008f3106fe08f288c227b87dae04ffd
net: bonding: Use strscpy_pad() instead of manually-truncated strncpy()

Silence this warning by using strscpy_pad() directly:

drivers/net/bonding/bond_main.c:4877:3: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
    4877 |   strncpy(params->primary, primary, IFNAMSIZ);
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Additionally replace other strncpy() uses, as it is considered deprecated:
https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/lkml/202102150705.fdR6obB0-lkp@intel.com
Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c
drivers/net/bonding/bond_options.c