drivers/net/ethernet/marvell/octeontx2/af/cgx.c:832:2: warning: argument 2 null where non-null expected

From: kernel test robot
Date: Wed Mar 03 2021 - 07:00:05 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7a7fd0de4a9804299793e564a555a49c1fc924cb
commit: 91c6945ea1f9059fea886630d0fd8070740e2aaf octeontx2-af: cn10k: Add RPM MAC support
date: 3 weeks ago
config: alpha-randconfig-r031-20210303 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=91c6945ea1f9059fea886630d0fd8070740e2aaf
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 91c6945ea1f9059fea886630d0fd8070740e2aaf
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In function 'link_status_user_format',
inlined from 'cgx_link_change_handler' at drivers/net/ethernet/marvell/octeontx2/af/cgx.c:847:2,
inlined from 'cgx_fwi_event_handler' at drivers/net/ethernet/marvell/octeontx2/af/cgx.c:933:4:
>> drivers/net/ethernet/marvell/octeontx2/af/cgx.c:832:2: warning: argument 2 null where non-null expected [-Wnonnull]
832 | strncpy(linfo->lmac_type, lmac_string, LMACTYPE_STR_LEN - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/string.h:21,
from include/linux/bitmap.h:9,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/mutex.h:17,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/of.h:17,
from include/linux/irqdomain.h:35,
from include/linux/acpi.h:13,
from drivers/net/ethernet/marvell/octeontx2/af/cgx.c:11:
drivers/net/ethernet/marvell/octeontx2/af/cgx.c: In function 'cgx_fwi_event_handler':
arch/alpha/include/asm/string.h:51:15: note: in a call to function 'strncpy' declared here
51 | extern char * strncpy(char *, const char *, size_t);
| ^~~~~~~
In function 'link_status_user_format',
inlined from 'cgx_link_change_handler' at drivers/net/ethernet/marvell/octeontx2/af/cgx.c:847:2,
inlined from 'cgx_fwi_event_handler' at drivers/net/ethernet/marvell/octeontx2/af/cgx.c:941:4:
>> drivers/net/ethernet/marvell/octeontx2/af/cgx.c:832:2: warning: argument 2 null where non-null expected [-Wnonnull]
832 | strncpy(linfo->lmac_type, lmac_string, LMACTYPE_STR_LEN - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/string.h:21,
from include/linux/bitmap.h:9,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/mutex.h:17,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/of.h:17,
from include/linux/irqdomain.h:35,
from include/linux/acpi.h:13,
from drivers/net/ethernet/marvell/octeontx2/af/cgx.c:11:
drivers/net/ethernet/marvell/octeontx2/af/cgx.c: In function 'cgx_fwi_event_handler':
arch/alpha/include/asm/string.h:51:15: note: in a call to function 'strncpy' declared here
51 | extern char * strncpy(char *, const char *, size_t);
| ^~~~~~~


vim +832 drivers/net/ethernet/marvell/octeontx2/af/cgx.c

9d8711b2558416 Christina Jacob 2021-02-09 818
61071a871ea6eb Linu Cherian 2018-10-16 819 static inline void link_status_user_format(u64 lstat,
61071a871ea6eb Linu Cherian 2018-10-16 820 struct cgx_link_user_info *linfo,
61071a871ea6eb Linu Cherian 2018-10-16 821 struct cgx *cgx, u8 lmac_id)
61071a871ea6eb Linu Cherian 2018-10-16 822 {
61071a871ea6eb Linu Cherian 2018-10-16 823 char *lmac_string;
61071a871ea6eb Linu Cherian 2018-10-16 824
61071a871ea6eb Linu Cherian 2018-10-16 825 linfo->link_up = FIELD_GET(RESP_LINKSTAT_UP, lstat);
61071a871ea6eb Linu Cherian 2018-10-16 826 linfo->full_duplex = FIELD_GET(RESP_LINKSTAT_FDUPLEX, lstat);
61071a871ea6eb Linu Cherian 2018-10-16 827 linfo->speed = cgx_speed_mbps[FIELD_GET(RESP_LINKSTAT_SPEED, lstat)];
56b6d539861358 Christina Jacob 2021-02-09 828 linfo->an = FIELD_GET(RESP_LINKSTAT_AN, lstat);
84c4f9cab4f99e Christina Jacob 2021-02-09 829 linfo->fec = FIELD_GET(RESP_LINKSTAT_FEC, lstat);
61071a871ea6eb Linu Cherian 2018-10-16 830 linfo->lmac_type_id = cgx_get_lmac_type(cgx, lmac_id);
61071a871ea6eb Linu Cherian 2018-10-16 831 lmac_string = cgx_lmactype_string[linfo->lmac_type_id];
61071a871ea6eb Linu Cherian 2018-10-16 @832 strncpy(linfo->lmac_type, lmac_string, LMACTYPE_STR_LEN - 1);
61071a871ea6eb Linu Cherian 2018-10-16 833 }
61071a871ea6eb Linu Cherian 2018-10-16 834

:::::: The code at line 832 was first introduced by commit
:::::: 61071a871ea6eb2125ece91c1a0dbb124a318c8a octeontx2-af: Forward CGX link notifications to PFs

:::::: TO: Linu Cherian <lcherian@xxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip