mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Henry Martin <bsdhenrymartin@gmail.com>,
	linux-wireless@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Angelo Gioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Chad Monroe <chad@monroe.io>, Felix Fietkau <nbd@nbd.name>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Peter Chiu <chui-hao.chiu@mediatek.com>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Sean Wang <sean.wang@mediatek.com>,
	Shayne Chen <shayne.chen@mediatek.com>,
	Shengyu Qu <wiagn233@outlook.com>
Subject: Re: [PATCH] wifi: mt76: mt7915: Fix null-ptr-deref in mt7915_mmio_wed_init()
Date: Thu, 3 Apr 2025 11:52:42 +0200	[thread overview]
Message-ID: <41f9ad4b-382c-4945-82ac-ec38bee87937@web.de> (raw)
In-Reply-To: <20250403065251.64749-1-bsdhenrymartin@gmail.com>

…
> Add NULL check after devm_ioremap() to prevent this issue.

Can a summary phrase like “Prevent null pointer dereference in mt7915_mmio_wed_init()”
be a bit nicer?


…
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c
> @@ -651,6 +651,8 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
>  		wed->wlan.base = devm_ioremap(dev->mt76.dev,
>  					      pci_resource_start(pci_dev, 0),
>  					      pci_resource_len(pci_dev, 0));
> +		if (!wed->wlan.base)
> +			return -ENOMEM;

Can a blank line be desirable after such a statement?


…
> @@ -678,6 +680,8 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
>  		wed->wlan.bus_type = MTK_WED_BUS_AXI;
>  		wed->wlan.base = devm_ioremap(dev->mt76.dev, res->start,
>  					      resource_size(res));
> +		if (!wed->wlan.base)
> +			return -ENOMEM;

Would the function “devm_platform_get_and_ioremap_resource” be applicable
in this else branch?
https://elixir.bootlin.com/linux/v6.14-rc6/source/drivers/base/platform.c#L87

Regards,
Markus

      reply	other threads:[~2025-04-03  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03  6:52 [PATCH v1] " Henry Martin
2025-04-03  9:52 ` 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=41f9ad4b-382c-4945-82ac-ec38bee87937@web.de \
    --to=markus.elfring@web.de \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bsdhenrymartin@gmail.com \
    --cc=chad@monroe.io \
    --cc=chui-hao.chiu@mediatek.com \
    --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=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    --cc=wiagn233@outlook.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®