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] [day] [month] [year] [list]
Date:   Wed, 23 Nov 2022 18:31:20 +0100
From:   Bean Huo <beanhuo@...pp.de>
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 v3 4/4] ufs: core: Remove ufshcd_map_desc_id_to_length
 function

On Mon, 2022-11-21 at 17:46 +0200, Arthur Simchaev wrote:
............
> -	if (param_offset >= buff_len) {
> -		dev_err(hba->dev, "%s: Invalid offset 0x%x in
> descriptor IDN 0x%x, length 0x%x\n",
> -			__func__, param_offset, desc_id, buff_len);
> -		return -EINVAL;
> -	}
> -
>  	/* Check whether we need temp memory */
>  	if (param_offset != 0 || param_size < buff_len) {
>  		desc_buf = kzalloc(buff_len, GFP_KERNEL);
> @@ -3434,15 +3407,23 @@ int ufshcd_read_desc_param(struct ufs_hba
> *hba,
>  
>  	/* Request for full descriptor */
>  	ret = ufshcd_query_descriptor_retry(hba,
> UPIU_QUERY_OPCODE_READ_DESC,
> -					desc_id, desc_index, 0,
> -					desc_buf, &buff_len);
> -
> +					    desc_id, desc_index, 0,
> +					    desc_buf, &buff_len);
>  	if (ret) {
>  		dev_err(hba->dev, "%s: Failed reading descriptor.
> desc_id %d, desc_index %d, param_offset %d, ret %d\n",
>  			__func__, desc_id, desc_index, param_offset,
> ret);
>  		goto out;
>  	}
>  
> +	/* Update descriptor length */
> +	buff_len = desc_buf[QUERY_DESC_LENGTH_OFFSET];
> +
> +	if (param_offset >= buff_len) {
> +		dev_err(hba->dev, "%s: Invalid offset 0x%x in
> descriptor IDN 0x%x, length 0x%x\n",
> +			__func__, param_offset, desc_id, buff_len);
> +		return -EINVAL;
> +	}
> +

a little bit concerned here, but understood your point that you want to
anyway read descriptor, then check if param_offset is a valid input. I
think, there is no problem. 

All in all, this series is a very nice cleanup, we removed all
unnecessary if-state, and complicated rules, making code more readable
than before.

Reviewed-by: Bean Huo <beanhuo@...ron.com>


Thanks,
Bean



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ