Re: [PATCH -next] tcmu: fix error return code in tcmu_configure_device()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxx>



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux