Re: [PATCH net v2] net: mvpp2: fix possible invalid pointer dereference

From: Andrew Lunn
Date: Tue Nov 15 2022 - 10:51:25 EST


On Tue, Nov 15, 2022 at 05:04:33PM +0800, Hui Tang wrote:
> It will cause invalid pointer dereference to priv->cm3_base behind,
> if PTR_ERR(priv->cm3_base) in mvpp2_get_sram().

As i pointed out for the MDIO driver, i wonder if this is the correct
fix. mvpp2_get_sram() is probably a better place to handle this

In fact, please add a devm_ioremap_resource_optional() which returns
NULL if the resource does not exist, or an error code for real errors,
and make drivers fail the probe on real errors.

Andrew