[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3329e7ed6714cd86ec91cca96e5980da1df11f11.camel@gmail.com>
Date: Sun, 31 May 2020 17:11:46 +0200
From: Bean Huo <huobean@...il.com>
To: Avri Altman <Avri.Altman@....com>,
"alim.akhtar@...sung.com" <alim.akhtar@...sung.com>,
"asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
"jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"stanley.chu@...iatek.com" <stanley.chu@...iatek.com>,
"beanhuo@...ron.com" <beanhuo@...ron.com>,
"bvanassche@....org" <bvanassche@....org>,
"tomas.winkler@...el.com" <tomas.winkler@...el.com>,
"cang@...eaurora.org" <cang@...eaurora.org>
Cc: "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 3/4] scsi: ufs: cleanup ufs initialization path
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
Powered by blists - more mailing lists