mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthias Brugger <matthias.bgg@gmail.com>
To: Ma Ke <make24@iscas.ac.cn>,
	nbd@nbd.name, lorenzo@kernel.org, ryder.lee@mediatek.com,
	shayne.chen@mediatek.com, sean.wang@mediatek.com,
	kvalo@kernel.org, angelogioacchino.delregno@collabora.com,
	ruanjinjie@huawei.com
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, stable@vger.kernel.org
Subject: Re: [PATCH] mt76: mt7615: check devm_kasprintf() returned value
Date: Thu, 5 Sep 2024 10:01:11 +0200	[thread overview]
Message-ID: <1ac78d8a-c0dc-4f90-9e25-6d9569894670@gmail.com> (raw)
In-Reply-To: <20240905014753.353271-1-make24@iscas.ac.cn>



On 05/09/2024 03:47, Ma Ke wrote:
> devm_kasprintf() can return a NULL pointer on failure but this returned
> value is not checked. Fix this lack and check the returned value.
> 
> Found by code review.
> 
> Cc: stable@vger.kernel.org
> Fixes: 0bb4e9187ea4 ("mt76: mt7615: fix hwmon temp sensor mem use-after-free")
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

If you find more problems of that sort in the mediatek wireless drivers, I think 
a better approach would be to send them all as one patch.

> ---
>   drivers/net/wireless/mediatek/mt76/mt7615/init.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> index f7722f67db57..0b9ebdcda221 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> @@ -56,6 +56,9 @@ int mt7615_thermal_init(struct mt7615_dev *dev)
>   
>   	name = devm_kasprintf(&wiphy->dev, GFP_KERNEL, "mt7615_%s",
>   			      wiphy_name(wiphy));
> +	if (!name)
> +		return -ENOMEM;
> +
>   	hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name, dev,
>   						       mt7615_hwmon_groups);
>   	return PTR_ERR_OR_ZERO(hwmon);

      reply	other threads:[~2024-09-05  8:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05  1:47 Ma Ke
2024-09-05  8:01 ` Matthias Brugger [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=1ac78d8a-c0dc-4f90-9e25-6d9569894670@gmail.com \
    --to=matthias.bgg@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=kvalo@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=make24@iscas.ac.cn \
    --cc=nbd@nbd.name \
    --cc=ruanjinjie@huawei.com \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    --cc=stable@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 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®