[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202111100232.gTpi4Iy8-lkp@intel.com>
Date: Wed, 10 Nov 2021 02:11:47 +0800
From: kernel test robot <lkp@...el.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
"Martin K. Petersen" <martin.petersen@...cle.com>
Subject: drivers/scsi/libfc/fc_encode.h:153:17: warning: 'strncpy' output may
be truncated copying between 0 and 255 bytes from a string of length 255
Hi Arnd,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d2f38a3c6507b2520101f9a3807ed98f1bdc545a
commit: e31ac898ac298b7a0451b0406769a024bd286e4d scsi: libfc: Move scsi/fc_encode.h to libfc
date: 1 year ago
config: microblaze-randconfig-r023-20211109 (attached as .config)
compiler: microblaze-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/torvalds/linux.git/commit/?id=e31ac898ac298b7a0451b0406769a024bd286e4d
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout e31ac898ac298b7a0451b0406769a024bd286e4d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=microblaze
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
In file included from drivers/scsi/libfc/fc_elsct.c:18:
drivers/scsi/libfc/fc_encode.h: In function 'fc_ct_ns_fill':
>> drivers/scsi/libfc/fc_encode.h:153:17: warning: 'strncpy' output may be truncated copying between 0 and 255 bytes from a string of length 255 [-Wstringop-truncation]
153 | strncpy(ct->payload.snn.fr_name,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154 | fc_host_symbolic_name(lport->host), len);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/libfc/fc_encode.h:143:17: warning: 'strncpy' output may be truncated copying between 0 and 255 bytes from a string of length 255 [-Wstringop-truncation]
143 | strncpy(ct->payload.spn.fr_name,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144 | fc_host_symbolic_name(lport->host), len);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/strncpy +153 drivers/scsi/libfc/fc_encode.h
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 81
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 82 /**
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 83 * fc_ct_ns_fill() - Fill in a name service request frame
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 84 * @lport: local port.
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 85 * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries.
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 86 * @fp: frame to contain payload.
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 87 * @op: CT opcode.
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 88 * @r_ctl: pointer to FC header R_CTL.
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 89 * @fh_type: pointer to FC-4 type.
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 90 */
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 91 static inline int fc_ct_ns_fill(struct fc_lport *lport,
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 92 u32 fc_id, struct fc_frame *fp,
a46f327aa5caf2 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 93 unsigned int op, enum fc_rctl *r_ctl,
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 94 enum fc_fh_type *fh_type)
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 95 {
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 96 struct fc_ct_req *ct;
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 97 size_t len;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 98
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 99 switch (op) {
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 100 case FC_NS_GPN_FT:
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 101 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_gid_ft),
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 102 FC_FST_DIR, FC_NS_SUBTYPE);
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 103 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 104 break;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 105
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 106 case FC_NS_GPN_ID:
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 107 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_fid),
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 108 FC_FST_DIR, FC_NS_SUBTYPE);
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 109 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP;
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 110 hton24(ct->payload.fid.fp_fid, fc_id);
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 111 break;
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 112
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 113 case FC_NS_RFT_ID:
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 114 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft),
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 115 FC_FST_DIR, FC_NS_SUBTYPE);
7b2787ec15b9d1 include/scsi/fc_encode.h Robert Love 2010-05-07 116 hton24(ct->payload.rft.fid.fp_fid, lport->port_id);
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 117 ct->payload.rft.fts = lport->fcts;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 118 break;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 119
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 120 case FC_NS_RFF_ID:
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 121 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id),
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 122 FC_FST_DIR, FC_NS_SUBTYPE);
7b2787ec15b9d1 include/scsi/fc_encode.h Robert Love 2010-05-07 123 hton24(ct->payload.rff.fr_fid.fp_fid, lport->port_id);
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 124 ct->payload.rff.fr_type = FC_TYPE_FCP;
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 125 if (lport->service_params & FCP_SPPF_INIT_FCN)
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 126 ct->payload.rff.fr_feat = FCP_FEAT_INIT;
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 127 if (lport->service_params & FCP_SPPF_TARG_FCN)
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 128 ct->payload.rff.fr_feat |= FCP_FEAT_TARG;
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 129 break;
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 130
c9c7bd7a5e7321 include/scsi/fc_encode.h Chris Leech 2009-11-03 131 case FC_NS_RNN_ID:
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 132 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id),
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 133 FC_FST_DIR, FC_NS_SUBTYPE);
7b2787ec15b9d1 include/scsi/fc_encode.h Robert Love 2010-05-07 134 hton24(ct->payload.rn.fr_fid.fp_fid, lport->port_id);
c9c7bd7a5e7321 include/scsi/fc_encode.h Chris Leech 2009-11-03 135 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn);
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 136 break;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 137
c9866a548024c3 include/scsi/fc_encode.h Chris Leech 2009-11-03 138 case FC_NS_RSPN_ID:
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 139 len = strnlen(fc_host_symbolic_name(lport->host), 255);
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 140 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len,
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 141 FC_FST_DIR, FC_NS_SUBTYPE);
7b2787ec15b9d1 include/scsi/fc_encode.h Robert Love 2010-05-07 142 hton24(ct->payload.spn.fr_fid.fp_fid, lport->port_id);
c9866a548024c3 include/scsi/fc_encode.h Chris Leech 2009-11-03 143 strncpy(ct->payload.spn.fr_name,
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 144 fc_host_symbolic_name(lport->host), len);
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 145 ct->payload.spn.fr_name_len = len;
c9866a548024c3 include/scsi/fc_encode.h Chris Leech 2009-11-03 146 break;
c9866a548024c3 include/scsi/fc_encode.h Chris Leech 2009-11-03 147
5baa17c3e66fc2 include/scsi/fc_encode.h Chris Leech 2009-11-03 148 case FC_NS_RSNN_NN:
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 149 len = strnlen(fc_host_symbolic_name(lport->host), 255);
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 150 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len,
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 151 FC_FST_DIR, FC_NS_SUBTYPE);
5baa17c3e66fc2 include/scsi/fc_encode.h Chris Leech 2009-11-03 152 put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn);
5baa17c3e66fc2 include/scsi/fc_encode.h Chris Leech 2009-11-03 @153 strncpy(ct->payload.snn.fr_name,
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 154 fc_host_symbolic_name(lport->host), len);
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 155 ct->payload.snn.fr_name_len = len;
5baa17c3e66fc2 include/scsi/fc_encode.h Chris Leech 2009-11-03 156 break;
5baa17c3e66fc2 include/scsi/fc_encode.h Chris Leech 2009-11-03 157
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 158 default:
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 159 return -EINVAL;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 160 }
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 161 *r_ctl = FC_RCTL_DD_UNSOL_CTL;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 162 *fh_type = FC_TYPE_CT;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 163 return 0;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 164 }
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 165
:::::: The code at line 153 was first introduced by commit
:::::: 5baa17c3e66fc2e414f501b2dd59b962dfc64919 [SCSI] libfc: Register Symbolic Node Name (RSNN_NN)
:::::: TO: Chris Leech <christopher.leech@...el.com>
:::::: CC: James Bottomley <James.Bottomley@...e.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (37955 bytes)
Powered by blists - more mailing lists