mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Kunwu Chan <chentao@kylinos.cn>,
	linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org,
	"James E. J. Bottomley" <jejb@linux.ibm.com>,
	"Manoj N. Kumar" <manoj@linux.ibm.com>,
	"Matthew R. Ochs" <mrochs@linux.ibm.com>,
	Uma Krishnan <ukrishn@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Kunwu Chan <kunwu.chan@hotmail.com>
Subject: Re: [PATCH] scsi: cxlflash: Fix null pointer dereference in ocxlflash_get_fd
Date: Wed, 17 Jan 2024 22:24:01 +0100	[thread overview]
Message-ID: <4934093b-86c0-4889-a5e9-0f9d63fd528c@web.de> (raw)
In-Reply-To: <20231127025127.1545877-1-chentao@kylinos.cn>

> 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

      reply	other threads:[~2024-01-17 21:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27  2:51 Kunwu Chan
2024-01-17 21:24 ` Markus Elfring [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4934093b-86c0-4889-a5e9-0f9d63fd528c@web.de \
    --to=markus.elfring@web.de \
    --cc=chentao@kylinos.cn \
    --cc=jejb@linux.ibm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kunwu.chan@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=manoj@linux.ibm.com \
    --cc=martin.petersen@oracle.com \
    --cc=mrochs@linux.ibm.com \
    --cc=ukrishn@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®