lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 7 Dec 2022 15:36:35 -0800
From:   Bart Van Assche <bvanassche@....org>
To:     Arthur Simchaev <Arthur.Simchaev@....com>,
        martin.petersen@...cle.com
Cc:     beanhuo@...ron.com, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/4] ufs: core: Remove redundant desc_size variable
 from hba

On 11/27/22 04:08, Arthur Simchaev wrote:
> Always read the descriptor with QUERY_DESC_MAX_SIZE.
> According to the spec, the device returns the actual size
> 
> Reviewed-by: Bean Huo <beanhuo@...ron.com>
> Signed-off-by: Arthur Simchaev <Arthur.Simchaev@....com>
> ---
>   drivers/ufs/core/ufshcd.c | 53 +++++++++++++----------------------------------
>   include/ufs/ufs.h         |  1 -
>   include/ufs/ufshcd.h      |  1 -
>   3 files changed, 14 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 2e47c69..70e96b6 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -3377,28 +3377,11 @@ int ufshcd_query_descriptor_retry(struct ufs_hba *hba,
>   void ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id,
>   				  int *desc_len)
>   {
> -	if (desc_id >= QUERY_DESC_IDN_MAX || desc_id == QUERY_DESC_IDN_RFU_0 ||
> -	    desc_id == QUERY_DESC_IDN_RFU_1)
> -		*desc_len = 0;
> -	else
> -		*desc_len = hba->desc_size[desc_id];
> +	/*Always returns QUERY_DESC_MAX_SIZE*/
> +	*desc_len = QUERY_DESC_MAX_SIZE;
>   }
>   EXPORT_SYMBOL(ufshcd_map_desc_id_to_length);

Comments should explain something that is nontrivial instead of duplicating the
code. Additionally, this change makes ufshcd_map_desc_id_to_length() too short
too keep it as a function. Please remove this function entirely and insert the
following code into the callers of this function:

desc_len = QUERY_DESC_MAX_SIZE

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ