Search Linux Wireless

Re: [PATCH] wifi: mt76: mt7915: Fix null-ptr-deref in mt7915_mmio_wed_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



…
> 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





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux