public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] tcmu: fix error return code in tcmu_configure_device()
@ 2018-01-11 11:12 Wei Yongjun
  2018-01-11 17:10 ` Mike Christie
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2018-01-11 11:12 UTC (permalink / raw)
  To: Nicholas A. Bellinger, Mike Christie
  Cc: Wei Yongjun, linux-scsi, target-devel, kernel-janitors

Fix to return error code -ENOMEM from the kzalloc() error handling
case instead of 0, as done elsewhere in this function.

Fixes: fabe6a59cc5a ("tcmu: allow max block and global max blocks to be settable")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/target/target_core_user.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index bac08bc..2edd242 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1705,8 +1705,10 @@ static int tcmu_configure_device(struct se_device *dev)
 
 	udev->data_bitmap = kzalloc(BITS_TO_LONGS(udev->max_blocks) *
 				    sizeof(unsigned long), GFP_KERNEL);
-	if (!udev->data_bitmap)
+	if (!udev->data_bitmap) {
+		ret = -ENOMEM;
 		goto err_bitmap_alloc;
+	}
 
 	udev->mb_addr = vzalloc(CMDR_SIZE);
 	if (!udev->mb_addr) {


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

* Re: [PATCH -next] tcmu: fix error return code in tcmu_configure_device()
  2018-01-11 11:12 [PATCH -next] tcmu: fix error return code in tcmu_configure_device() Wei Yongjun
@ 2018-01-11 17:10 ` Mike Christie
  2018-01-13  5:19   ` Nicholas A. Bellinger
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Christie @ 2018-01-11 17:10 UTC (permalink / raw)
  To: Wei Yongjun, Nicholas A. Bellinger
  Cc: linux-scsi, target-devel, kernel-janitors

On 01/11/2018 05:12 AM, Wei Yongjun wrote:
> Fix to return error code -ENOMEM from the kzalloc() error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: fabe6a59cc5a ("tcmu: allow max block and global max blocks to be settable")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/target/target_core_user.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index bac08bc..2edd242 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -1705,8 +1705,10 @@ static int tcmu_configure_device(struct se_device *dev)
>  
>  	udev->data_bitmap = kzalloc(BITS_TO_LONGS(udev->max_blocks) *
>  				    sizeof(unsigned long), GFP_KERNEL);
> -	if (!udev->data_bitmap)
> +	if (!udev->data_bitmap) {
> +		ret = -ENOMEM;
>  		goto err_bitmap_alloc;
> +	}
>  
>  	udev->mb_addr = vzalloc(CMDR_SIZE);
>  	if (!udev->mb_addr) {
> 

Thanks.

Acked-by: Mike Christie <mchristi@redhat.com>

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

* Re: [PATCH -next] tcmu: fix error return code in tcmu_configure_device()
  2018-01-11 17:10 ` Mike Christie
@ 2018-01-13  5:19   ` Nicholas A. Bellinger
  0 siblings, 0 replies; 3+ messages in thread
From: Nicholas A. Bellinger @ 2018-01-13  5:19 UTC (permalink / raw)
  To: Mike Christie; +Cc: Wei Yongjun, linux-scsi, target-devel, kernel-janitors

On Thu, 2018-01-11 at 11:10 -0600, Mike Christie wrote:
> On 01/11/2018 05:12 AM, Wei Yongjun wrote:
> > Fix to return error code -ENOMEM from the kzalloc() error handling
> > case instead of 0, as done elsewhere in this function.
> > 
> > Fixes: fabe6a59cc5a ("tcmu: allow max block and global max blocks to be settable")
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> >  drivers/target/target_core_user.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> > index bac08bc..2edd242 100644
> > --- a/drivers/target/target_core_user.c
> > +++ b/drivers/target/target_core_user.c
> > @@ -1705,8 +1705,10 @@ static int tcmu_configure_device(struct se_device *dev)
> >  
> >  	udev->data_bitmap = kzalloc(BITS_TO_LONGS(udev->max_blocks) *
> >  				    sizeof(unsigned long), GFP_KERNEL);
> > -	if (!udev->data_bitmap)
> > +	if (!udev->data_bitmap) {
> > +		ret = -ENOMEM;
> >  		goto err_bitmap_alloc;
> > +	}
> >  
> >  	udev->mb_addr = vzalloc(CMDR_SIZE);
> >  	if (!udev->mb_addr) {
> > 
> 
> Thanks.
> 
> Acked-by: Mike Christie <mchristi@redhat.com>

Applied.  Thanks Wei + MNC.


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

end of thread, other threads:[~2018-01-13  5:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-11 11:12 [PATCH -next] tcmu: fix error return code in tcmu_configure_device() Wei Yongjun
2018-01-11 17:10 ` Mike Christie
2018-01-13  5:19   ` Nicholas A. Bellinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox