Re: [PATCH 6/6] scsi: qedf: use correct strncpy() size
From: kbuild test robot
Date: Sun Feb 04 2018 - 22:04:24 EST
Hi Arnd,
I love your patch! Perhaps something to improve:
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/scsi-fixes-for-building-with-LTO/20180205-083607
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All warnings (new ones prefixed by >>):
drivers/scsi//qedf/qedf_dbg.c: In function 'qedf_uevent_emit':
>> drivers/scsi//qedf/qedf_dbg.c:163:4: warning: ignoring return value of 'strscpy', declared with attribute warn_unused_result [-Wunused-result]
strscpy(event_string, msg, sizeof(event_string));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/strscpy +163 drivers/scsi//qedf/qedf_dbg.c
152
153 void
154 qedf_uevent_emit(struct Scsi_Host *shost, u32 code, char *msg)
155 {
156 char event_string[40];
157 char *envp[] = {event_string, NULL};
158
159 memset(event_string, 0, sizeof(event_string));
160 switch (code) {
161 case QEDF_UEVENT_CODE_GRCDUMP:
162 if (msg)
> 163 strscpy(event_string, msg, sizeof(event_string));
164 else
165 sprintf(event_string, "GRCDUMP=%u", shost->host_no);
166 break;
167 default:
168 /* do nothing */
169 break;
170 }
171
172 kobject_uevent_env(&shost->shost_gendev.kobj, KOBJ_CHANGE, envp);
173 }
174
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip