[s390:features 20/21] drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length

From: kernel test robot
Date: Wed Aug 25 2021 - 11:19:27 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
head: 0d6d75d2a2c341ce99f0549fa28bee93fa56505d
commit: 70aa5d39826528e77f5595a5f9297d919112d396 [20/21] s390/sclp: add tracing of SCLP interactions
config: s390-buildonly-randconfig-r005-20210825 (attached as .config)
compiler: s390-linux-gcc (GCC) 11.2.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/s390/linux.git/commit/?id=70aa5d39826528e77f5595a5f9297d919112d396
git remote add s390 https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git
git fetch --no-tags s390 features
git checkout 70aa5d39826528e77f5595a5f9297d919112d396
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=s390

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 'sclp_trace',
inlined from 'sclp_trace_evbuf' at drivers/s390/char/sclp.c:141:2,
inlined from 'sclp_dispatch_evbufs.isra' at drivers/s390/char/sclp.c:562:3:
>> drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
84 | strncpy(e.id, id, sizeof(e.id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'sclp_trace',
inlined from 'sclp_dispatch_state_change' at drivers/s390/char/sclp.c:794:4:
>> drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
84 | strncpy(e.id, id, sizeof(e.id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'sclp_trace',
inlined from 'sclp_trace_req' at drivers/s390/char/sclp.c:166:2,
inlined from 'sclp_req_queue_timeout' at drivers/s390/char/sclp.c:373:4:
>> drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
84 | strncpy(e.id, id, sizeof(e.id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'sclp_trace',
inlined from 'sclp_trace_sccb' at drivers/s390/char/sclp.c:131:2,
inlined from 'sclp_service_call_trace' at drivers/s390/char/sclp.c:393:2:
>> drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
84 | strncpy(e.id, id, sizeof(e.id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'sclp_trace',
inlined from 'sclp_service_call_trace' at drivers/s390/char/sclp.c:398:2:
>> drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
84 | strncpy(e.id, id, sizeof(e.id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'sclp_trace',
inlined from 'sclp_trace_req' at drivers/s390/char/sclp.c:166:2,
inlined from 'sclp_process_queue' at drivers/s390/char/sclp.c:469:3:
>> drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
84 | strncpy(e.id, id, sizeof(e.id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'sclp_trace',
inlined from 'sclp_interrupt_handler' at drivers/s390/char/sclp.c:689:4:
>> drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
84 | strncpy(e.id, id, sizeof(e.id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'sclp_trace',
inlined from 'sclp_trace_req' at drivers/s390/char/sclp.c:166:2,
inlined from 'sclp_interrupt_handler' at drivers/s390/char/sclp.c:680:4:
>> drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
84 | strncpy(e.id, id, sizeof(e.id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'sclp_trace',
inlined from 'sclp_add_request' at drivers/s390/char/sclp.c:505:2:
>> drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
84 | strncpy(e.id, id, sizeof(e.id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'sclp_trace',
inlined from 'sclp_sync_wait' at drivers/s390/char/sclp.c:721:2:
>> drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
84 | strncpy(e.id, id, sizeof(e.id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'sclp_trace',
inlined from 'sclp_sync_wait' at drivers/s390/char/sclp.c:762:2:
>> drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
84 | strncpy(e.id, id, sizeof(e.id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'sclp_trace',
inlined from 'sclp_trace_register' at drivers/s390/char/sclp.c:180:2,
inlined from 'sclp_unregister' at drivers/s390/char/sclp.c:908:2:
>> drivers/s390/char/sclp.c:84:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
84 | strncpy(e.id, id, sizeof(e.id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/strncpy +84 drivers/s390/char/sclp.c

78
79 static inline void sclp_trace(int prio, char *id, u32 a, u64 b, bool err)
80 {
81 struct sclp_trace_entry e;
82
83 memset(&e, 0, sizeof(e));
> 84 strncpy(e.id, id, sizeof(e.id));
85 e.a = a;
86 e.b = b;
87 debug_event(&sclp_debug, prio, &e, sizeof(e));
88 if (err)
89 debug_event(&sclp_debug_err, 0, &e, sizeof(e));
90 }
91

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

Attachment: .config.gz
Description: application/gzip