scsi: lpfc: Fix compiler warning on frame size
authorJames Smart <jsmart2021@gmail.com>
Tue, 28 Jan 2020 00:23:06 +0000 (16:23 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 11 Feb 2020 03:46:56 +0000 (22:46 -0500)
The following error is see from the compiler:

  drivers/scsi/lpfc/lpfc_init.c: In function
    ‘lpfc_cpuhp_get_eq’: drivers/scsi/lpfc/lpfc_init.c:12660:1:
      error: the frame size of 1032 bytes is larger than 1024 bytes
         [-Werror=frame-larger-than=]

The issue is due to allocating a cpumask on the stack.

Fix by converting to a dynamical allocation of the cpu mask.

Link: https://lore.kernel.org/r/20200128002312.16346-7-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_init.c

index 9fd238d49117e91992af870528f5726814402580..9a6191818a238c595fd766292f0001a1d68933c7 100644 (file)
@@ -11106,15 +11106,19 @@ found_any:
  * @cpu:    cpu going offline
  * @eqlist:
  */
-static void
+static int
 lpfc_cpuhp_get_eq(struct lpfc_hba *phba, unsigned int cpu,
                  struct list_head *eqlist)
 {
        const struct cpumask *maskp;
        struct lpfc_queue *eq;
-       cpumask_t tmp;
+       struct cpumask *tmp;
        u16 idx;
 
+       tmp = kzalloc(cpumask_size(), GFP_KERNEL);
+       if (!tmp)
+               return -ENOMEM;
+
        for (idx = 0; idx < phba->cfg_irq_chann; idx++) {
                maskp = pci_irq_get_affinity(phba->pcidev, idx);
                if (!maskp)
@@ -11124,7 +11128,7 @@ lpfc_cpuhp_get_eq(struct lpfc_hba *phba, unsigned int cpu,
                 * then we don't need to poll the eq attached
                 * to it.
                 */
-               if (!cpumask_and(&tmp, maskp, cpumask_of(cpu)))
+               if (!cpumask_and(tmp, maskp, cpumask_of(cpu)))
                        continue;
                /* get the cpus that are online and are affini-
                 * tized to this irq vector.  If the count is
@@ -11132,8 +11136,8 @@ lpfc_cpuhp_get_eq(struct lpfc_hba *phba, unsigned int cpu,
                 * down this vector.  Since this cpu has not
                 * gone offline yet, we need >1.
                 */
-               cpumask_and(&tmp, maskp, cpu_online_mask);
-               if (cpumask_weight(&tmp) > 1)
+               cpumask_and(tmp, maskp, cpu_online_mask);
+               if (cpumask_weight(tmp) > 1)
                        continue;
 
                /* Now that we have an irq to shutdown, get the eq
@@ -11144,6 +11148,8 @@ lpfc_cpuhp_get_eq(struct lpfc_hba *phba, unsigned int cpu,
                eq = phba->sli4_hba.hba_eq_hdl[idx].eq;
                list_add(&eq->_poll_list, eqlist);
        }
+       kfree(tmp);
+       return 0;
 }
 
 static void __lpfc_cpuhp_remove(struct lpfc_hba *phba)
@@ -11314,7 +11320,9 @@ static int lpfc_cpu_offline(unsigned int cpu, struct hlist_node *node)
 
        lpfc_irq_rebalance(phba, cpu, true);
 
-       lpfc_cpuhp_get_eq(phba, cpu, &eqlist);
+       retval = lpfc_cpuhp_get_eq(phba, cpu, &eqlist);
+       if (retval)
+               return retval;
 
        /* start polling on these eq's */
        list_for_each_entry_safe(eq, next, &eqlist, _poll_list) {