Re: [bug report] scsi: lpfc: Validate ELS LS_ACC completion payload

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

Yes, you’re right.  We should change that to use list_first_entry_or_null.

Thanks for pointing this out and we will push a patch to correct this.

Regards,
Justin

On Tue, Oct 17, 2023 at 6:54 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
>
> Hello Justin Tee,
>
> The patch a3c3c0a806f1: "scsi: lpfc: Validate ELS LS_ACC completion
> payload" from Oct 9, 2023 (linux-next), leads to the following Smatch
> static checker warning:
>
>         drivers/scsi/lpfc/lpfc_els.c:2133 lpfc_cmpl_els_plogi()
>         warn: list_entry() does not return NULL 'prsp'
>
> drivers/scsi/lpfc/lpfc_els.c
>     2126                 if (release_node)
>     2127                         lpfc_disc_state_machine(vport, ndlp, cmdiocb,
>     2128                                                 NLP_EVT_DEVICE_RM);
>     2129         } else {
>     2130                 /* Good status, call state machine */
>     2131                 prsp = list_entry(cmdiocb->cmd_dmabuf->list.next,
>     2132                                   struct lpfc_dmabuf, list);
> --> 2133                 if (!prsp)
>
> list_entry() never returns NULL.  If the list is empty it returns an
> invalid pointer.  Did you want to use list_entry_or_null()?
>
>     2134                         goto out;
>     2135                 if (!lpfc_is_els_acc_rsp(prsp))
>     2136                         goto out;
>     2137                 ndlp = lpfc_plogi_confirm_nport(phba, prsp->virt, ndlp);
>
> regards,
> dan carpenter




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux