Re: [PATCH] scsi: cxlflash: Fix null pointer dereference in ocxlflash_get_fd

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

 



> kasprintf() returns a pointer to dynamically allocated memory
> which can be NULL upon failure.
…
> +++ b/drivers/scsi/cxlflash/ocxl_hw.c
> @@ -1231,6 +1231,11 @@ static struct file *ocxlflash_get_fd(void *ctx_cookie,
>  		fops = (struct file_operations *)&ocxl_afu_fops;
>
>  	name = kasprintf(GFP_KERNEL, "ocxlflash:%d", ctx->pe);
> +	if (!name) {
> +		rc = -ENOMEM;
> +		dev_err(dev, "%s: kasprintf allocation failed\n", __func__);
> +		goto err2;
> +	}
…

How do you think about to omit the extra error message?

Regards,
Markus





[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