]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
scsi: mptctl: change strncpy+truncation to strlcpy
authorDominique Martinet <asmadeus@codewreck.org>
Fri, 13 Jul 2018 01:25:37 +0000 (03:25 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 31 Jul 2018 03:17:53 +0000 (23:17 -0400)
Generated by scripts/coccinelle/misc/strncpy_truncation.cocci

Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/message/fusion/mptctl.c

index 4470630dd54552032a3d92dc73c101289ab62d41..8d22d6134a89d1abb7d55c59663d8de51ae8b550 100644 (file)
@@ -2514,8 +2514,8 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
                                if (mpt_config(ioc, &cfg) == 0) {
                                        ManufacturingPage0_t *pdata = (ManufacturingPage0_t *) pbuf;
                                        if (strlen(pdata->BoardTracerNumber) > 1) {
-                                               strncpy(karg.serial_number,                                                                         pdata->BoardTracerNumber, 24);
-                                               karg.serial_number[24-1]='\0';
+                                               strlcpy(karg.serial_number,
+                                                       pdata->BoardTracerNumber, 24);
                                        }
                                }
                                pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, pbuf, buf_dma);