All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Gen Zhang <blackgod016574@gmail.com>
Cc: jassisinghbrar@gmail.com, linux-kernel@vger.kernel.org,
	linux-tegra@vger.kernel.org
Subject: Re: [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create()
Date: Mon, 27 May 2019 16:05:49 +0200	[thread overview]
Message-ID: <20190527140549.GA7202@ulmo> (raw)
In-Reply-To: <20190527130430.GA5367@zhanggen-UX430UQ>

[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

On Mon, May 27, 2019 at 09:04:30PM +0800, Gen Zhang wrote:
> In tegra_hsp_doorbell_create(), 'db->name' is allocated by 
> devm_kstrdup_const(). It returns NULL when fails. So 'db->name' should
> be checked.
> 
> Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
> ---
> diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
> index 11fc9fd..b613c46 100644
> --- a/drivers/mailbox/tegra-hsp.c
> +++ b/drivers/mailbox/tegra-hsp.c
> @@ -292,6 +292,8 @@ tegra_hsp_doorbell_create(struct tegra_hsp *hsp, const char *name,
>  	db->channel.hsp = hsp;
>  
>  	db->name = devm_kstrdup_const(hsp->dev, name, GFP_KERNEL);
> +	if (!db->name)
> +		return ERR_PTR(-ENOMEM);

I don't think this could ever happen, since name is always from .rodata
and hence devm_kstrdup_const() never returns NULL. But formally this is
correct, so:

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-05-27 14:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27 13:04 [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create() Gen Zhang
2019-05-27 14:05 ` Thierry Reding [this message]
2019-05-27 14:10   ` Gen Zhang
  -- strict thread matches above, loose matches on Subject: below --
2019-05-30  1:19 Gen Zhang
2019-06-08 16:11 ` Gen Zhang
2019-06-17  9:23   ` Gen Zhang

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=20190527140549.GA7202@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=blackgod016574@gmail.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.