]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scsi: lpfc: Resolve checker warning for lpfc_new_io_buf()
authorJames Smart <jsmart2021@gmail.com>
Tue, 27 Aug 2019 21:27:46 +0000 (14:27 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 29 Aug 2019 22:07:59 +0000 (18:07 -0400)
Per Dan Carpenter:

The patch d79c9e9d4b3d: "scsi: lpfc: Support dynamic unbounded SGL lists on
G7 hardware." from Aug 14, 2019, leads to the following static checker
warning:

   drivers/scsi/lpfc/lpfc_init.c:4107 lpfc_new_io_buf()
  error: not allocating enough data 784 vs 768

There was no need to compare sizes nor to allocate size based on a define.

Change allocation to use actual structure length

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
CC: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli4.h

index 0bc04af1d2fb57114becb9b1bcace03467252c79..de92eb86579af735e538c2b93e9d3707eebbd213 100644 (file)
@@ -4093,18 +4093,9 @@ lpfc_new_io_buf(struct lpfc_hba *phba, int num_to_alloc)
        LIST_HEAD(post_nblist);
        LIST_HEAD(nvme_nblist);
 
-       /* Sanity check to ensure our sizing is right for both SCSI and NVME */
-       if (sizeof(struct lpfc_io_buf) > LPFC_COMMON_IO_BUF_SZ) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
-                               "6426 Common buffer size %zd exceeds %d\n",
-                               sizeof(struct lpfc_io_buf),
-                               LPFC_COMMON_IO_BUF_SZ);
-               return 0;
-       }
-
        phba->sli4_hba.io_xri_cnt = 0;
        for (bcnt = 0; bcnt < num_to_alloc; bcnt++) {
-               lpfc_ncmd = kzalloc(LPFC_COMMON_IO_BUF_SZ, GFP_KERNEL);
+               lpfc_ncmd = kzalloc(sizeof(*lpfc_ncmd), GFP_KERNEL);
                if (!lpfc_ncmd)
                        break;
                /*
index 11a72bbef8f73854c92acac65e2dda6e1c32173f..4bdd58de469294fac084aab3d8757620f936ee2b 100644 (file)
@@ -44,9 +44,6 @@
 #define LPFC_HBA_HDWQ_MAX      128
 #define LPFC_HBA_HDWQ_DEF      0
 
-/* Common buffer size to accomidate SCSI and NVME IO buffers */
-#define LPFC_COMMON_IO_BUF_SZ  768
-
 /*
  * Provide the default FCF Record attributes used by the driver
  * when nonFIP mode is configured and there is no other default