Linux-SCSI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH -next] scsi: ufs: Use kmemdup in ufshcd_read_string_desc()
@ 2019-08-31 12:44 YueHaibing
  2019-08-31 19:37 ` Winkler, Tomas
  2019-09-07 20:40 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: YueHaibing @ 2019-08-31 12:44 UTC (permalink / raw)
  To: Alim Akhtar, Avri Altman, Pedro Sousa, James E.J. Bottomley,
	Martin K. Petersen, Tomas Winkler, Subhash Jadavani
  Cc: YueHaibing, linux-scsi, linux-kernel, kernel-janitors

Use kmemdup rather than duplicating its implementation

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/scsi/ufs/ufshcd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index acf298da054c..6d5e2f5d8468 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -3309,12 +3309,11 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
 		str[ret++] = '\0';
 
 	} else {
-		str = kzalloc(uc_str->len, GFP_KERNEL);
+		str = kmemdup(uc_str, uc_str->len, GFP_KERNEL);
 		if (!str) {
 			ret = -ENOMEM;
 			goto out;
 		}
-		memcpy(str, uc_str, uc_str->len);
 		ret = uc_str->len;
 	}
 out:




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH -next] scsi: ufs: Use kmemdup in ufshcd_read_string_desc()
  2019-08-31 12:44 [PATCH -next] scsi: ufs: Use kmemdup in ufshcd_read_string_desc() YueHaibing
@ 2019-08-31 19:37 ` Winkler, Tomas
  2019-09-07 20:40 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Winkler, Tomas @ 2019-08-31 19:37 UTC (permalink / raw)
  To: YueHaibing, Alim Akhtar, Avri Altman, Pedro Sousa,
	James E.J. Bottomley, Martin K. Petersen, Subhash Jadavani
  Cc: linux-scsi, linux-kernel, kernel-janitors



> Use kmemdup rather than duplicating its implementation
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
LGTM, ACK.
Tomas
 
> ---
>  drivers/scsi/ufs/ufshcd.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index
> acf298da054c..6d5e2f5d8468 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -3309,12 +3309,11 @@ int ufshcd_read_string_desc(struct ufs_hba *hba,
> u8 desc_index,
>  		str[ret++] = '\0';
> 
>  	} else {
> -		str = kzalloc(uc_str->len, GFP_KERNEL);
> +		str = kmemdup(uc_str, uc_str->len, GFP_KERNEL);
>  		if (!str) {
>  			ret = -ENOMEM;
>  			goto out;
>  		}
> -		memcpy(str, uc_str, uc_str->len);
>  		ret = uc_str->len;
>  	}
>  out:
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] scsi: ufs: Use kmemdup in ufshcd_read_string_desc()
  2019-08-31 12:44 [PATCH -next] scsi: ufs: Use kmemdup in ufshcd_read_string_desc() YueHaibing
  2019-08-31 19:37 ` Winkler, Tomas
@ 2019-09-07 20:40 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-09-07 20:40 UTC (permalink / raw)
  To: YueHaibing
  Cc: Alim Akhtar, Avri Altman, Pedro Sousa, James E.J. Bottomley,
	Martin K. Petersen, Tomas Winkler, Subhash Jadavani, linux-scsi,
	linux-kernel, kernel-janitors


YueHaibing,

> Use kmemdup rather than duplicating its implementation

Applied to 5.4/scsi-queue. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-31 12:44 [PATCH -next] scsi: ufs: Use kmemdup in ufshcd_read_string_desc() YueHaibing
2019-08-31 19:37 ` Winkler, Tomas
2019-09-07 20:40 ` Martin K. Petersen

Linux-SCSI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-scsi/0 linux-scsi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-scsi linux-scsi/ https://lore.kernel.org/linux-scsi \
		linux-scsi@vger.kernel.org linux-scsi@archiver.kernel.org
	public-inbox-index linux-scsi


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-scsi


AGPL code for this site: git clone https://public-inbox.org/ public-inbox