Re: [PATCH v4 3/4] scsi: ufs: cleanup ufs initialization path

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

 



On Sat, 2020-05-30 at 06:37 +0000, Avri Altman wrote:
> > +       /* Get the length of descriptor */
> > +       ufshcd_map_desc_id_to_length(hba, desc_id, &buff_len);
> > +       if (!buff_len) {
> > +               dev_err(hba->dev, "%s: Failed to get desc length",
> > __func__);
> > +               return -EINVAL;
> >          }
> > 
> >          /* Check whether we need temp memory */
> 
> The first time we are reading the descriptor, we no longer can rely
> on its true size.
> So for this check, buff_len is 256 and kmalloc will always happen. 
> Do you think that this check is still relevant?
> 
> /* Check whether we need temp memory */
>         if (param_offset != 0 || param_size < buff_len) {
>                 desc_buf = kmalloc(buff_len, GFP_KERNEL);
>                 if (!desc_buf)
>                         return -ENOMEM;
>         } else {
>                 desc_buf = param_read_buf;
>                 is_kmalloc = false;
>         }

Avri
I found this checkup is still needed since LU descriptor read will
multiple enter this function. so I didn't delete it in the new version
patch.

thanks,
Bean




[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