[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190527140549.GA7202@ulmo>
Date: Mon, 27 May 2019 16:05:49 +0200
From: Thierry Reding <thierry.reding@...il.com>
To: Gen Zhang <blackgod016574@...il.com>
Cc: jassisinghbrar@...il.com, linux-kernel@...r.kernel.org,
linux-tegra@...r.kernel.org
Subject: Re: [PATCH] tegra-hsp: fix a missing-check bug in
tegra_hsp_doorbell_create()
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@...il.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@...dia.com>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists