* [linux-next:master 5653/9209] drivers/scsi/mpi3mr/mpi3mr_fw.c:1172:2: warning: 'strncpy' output may be truncated copying 16 bytes from a string of length 64
@ 2021-06-15 10:09 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-06-15 10:09 UTC (permalink / raw)
To: Kashyap Desai
Cc: kbuild-all, Linux Memory Management List, Martin K. Petersen,
Hannes Reinecke, Tomas Henzl, Himanshu Madhani
[-- Attachment #1: Type: text/plain, Size: 6603 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 25fe90f43fa312213b653dc1f12fd2d80f855883
commit: 824a156633dfdb0e17979a0d0bb2c757d1bb949c [5653/9209] scsi: mpi3mr: Base driver code
config: x86_64-randconfig-r031-20210615 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=824a156633dfdb0e17979a0d0bb2c757d1bb949c
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 824a156633dfdb0e17979a0d0bb2c757d1bb949c
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/scsi/mpi3mr/mpi3mr_fw.c: In function 'mpi3mr_issue_iocinit':
>> drivers/scsi/mpi3mr/mpi3mr_fw.c:1172:2: warning: 'strncpy' output may be truncated copying 16 bytes from a string of length 64 [-Wstringop-truncation]
1172 | strncpy(drv_info->os_name, utsname()->sysname, sizeof(drv_info->os_name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/mpi3mr/mpi3mr_fw.c:1174:2: warning: 'strncpy' output may be truncated copying 12 bytes from a string of length 64 [-Wstringop-truncation]
1174 | strncpy(drv_info->os_version, utsname()->release, sizeof(drv_info->os_version));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/strncpy +1172 drivers/scsi/mpi3mr/mpi3mr_fw.c
1145
1146 /**
1147 * mpi3mr_issue_iocinit - Send IOC Init
1148 * @mrioc: Adapter instance reference
1149 *
1150 * Issue IOC Init MPI request through admin queue and wait for
1151 * the completion of it or time out.
1152 *
1153 * Return: 0 on success, non-zero on failures.
1154 */
1155 static int mpi3mr_issue_iocinit(struct mpi3mr_ioc *mrioc)
1156 {
1157 struct mpi3_ioc_init_request iocinit_req;
1158 struct mpi3_driver_info_layout *drv_info;
1159 dma_addr_t data_dma;
1160 u32 data_len = sizeof(*drv_info);
1161 int retval = 0;
1162 ktime_t current_time;
1163
1164 drv_info = dma_alloc_coherent(&mrioc->pdev->dev, data_len, &data_dma,
1165 GFP_KERNEL);
1166 if (!drv_info) {
1167 retval = -1;
1168 goto out;
1169 }
1170 drv_info->information_length = cpu_to_le32(data_len);
1171 strncpy(drv_info->driver_signature, "Broadcom", sizeof(drv_info->driver_signature));
> 1172 strncpy(drv_info->os_name, utsname()->sysname, sizeof(drv_info->os_name));
1173 drv_info->os_name[sizeof(drv_info->os_name) - 1] = 0;
1174 strncpy(drv_info->os_version, utsname()->release, sizeof(drv_info->os_version));
1175 drv_info->os_version[sizeof(drv_info->os_version) - 1] = 0;
1176 strncpy(drv_info->driver_name, MPI3MR_DRIVER_NAME, sizeof(drv_info->driver_name));
1177 strncpy(drv_info->driver_version, MPI3MR_DRIVER_VERSION, sizeof(drv_info->driver_version));
1178 strncpy(drv_info->driver_release_date, MPI3MR_DRIVER_RELDATE, sizeof(drv_info->driver_release_date));
1179 drv_info->driver_capabilities = 0;
1180 memcpy((u8 *)&mrioc->driver_info, (u8 *)drv_info,
1181 sizeof(mrioc->driver_info));
1182
1183 memset(&iocinit_req, 0, sizeof(iocinit_req));
1184 mutex_lock(&mrioc->init_cmds.mutex);
1185 if (mrioc->init_cmds.state & MPI3MR_CMD_PENDING) {
1186 retval = -1;
1187 ioc_err(mrioc, "Issue IOCInit: Init command is in use\n");
1188 mutex_unlock(&mrioc->init_cmds.mutex);
1189 goto out;
1190 }
1191 mrioc->init_cmds.state = MPI3MR_CMD_PENDING;
1192 mrioc->init_cmds.is_waiting = 1;
1193 mrioc->init_cmds.callback = NULL;
1194 iocinit_req.host_tag = cpu_to_le16(MPI3MR_HOSTTAG_INITCMDS);
1195 iocinit_req.function = MPI3_FUNCTION_IOC_INIT;
1196 iocinit_req.mpi_version.mpi3_version.dev = MPI3_VERSION_DEV;
1197 iocinit_req.mpi_version.mpi3_version.unit = MPI3_VERSION_UNIT;
1198 iocinit_req.mpi_version.mpi3_version.major = MPI3_VERSION_MAJOR;
1199 iocinit_req.mpi_version.mpi3_version.minor = MPI3_VERSION_MINOR;
1200 iocinit_req.who_init = MPI3_WHOINIT_HOST_DRIVER;
1201 iocinit_req.reply_free_queue_depth = cpu_to_le16(mrioc->reply_free_qsz);
1202 iocinit_req.reply_free_queue_address =
1203 cpu_to_le64(mrioc->reply_free_q_dma);
1204 iocinit_req.sense_buffer_length = cpu_to_le16(MPI3MR_SENSEBUF_SZ);
1205 iocinit_req.sense_buffer_free_queue_depth =
1206 cpu_to_le16(mrioc->sense_buf_q_sz);
1207 iocinit_req.sense_buffer_free_queue_address =
1208 cpu_to_le64(mrioc->sense_buf_q_dma);
1209 iocinit_req.driver_information_address = cpu_to_le64(data_dma);
1210
1211 current_time = ktime_get_real();
1212 iocinit_req.time_stamp = cpu_to_le64(ktime_to_ms(current_time));
1213
1214 init_completion(&mrioc->init_cmds.done);
1215 retval = mpi3mr_admin_request_post(mrioc, &iocinit_req,
1216 sizeof(iocinit_req), 1);
1217 if (retval) {
1218 ioc_err(mrioc, "Issue IOCInit: Admin Post failed\n");
1219 goto out_unlock;
1220 }
1221 wait_for_completion_timeout(&mrioc->init_cmds.done,
1222 (MPI3MR_INTADMCMD_TIMEOUT * HZ));
1223 if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) {
1224 mpi3mr_set_diagsave(mrioc);
1225 mpi3mr_issue_reset(mrioc,
1226 MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT,
1227 MPI3MR_RESET_FROM_IOCINIT_TIMEOUT);
1228 mrioc->unrecoverable = 1;
1229 ioc_err(mrioc, "Issue IOCInit: command timed out\n");
1230 retval = -1;
1231 goto out_unlock;
1232 }
1233 if ((mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK)
1234 != MPI3_IOCSTATUS_SUCCESS) {
1235 ioc_err(mrioc,
1236 "Issue IOCInit: Failed ioc_status(0x%04x) Loginfo(0x%08x)\n",
1237 (mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK),
1238 mrioc->init_cmds.ioc_loginfo);
1239 retval = -1;
1240 goto out_unlock;
1241 }
1242
1243 out_unlock:
1244 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED;
1245 mutex_unlock(&mrioc->init_cmds.mutex);
1246
1247 out:
1248 if (drv_info)
1249 dma_free_coherent(&mrioc->pdev->dev, data_len, drv_info,
1250 data_dma);
1251
1252 return retval;
1253 }
1254
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33475 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-15 10:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 10:09 [linux-next:master 5653/9209] drivers/scsi/mpi3mr/mpi3mr_fw.c:1172:2: warning: 'strncpy' output may be truncated copying 16 bytes from a string of length 64 kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox