Re: [PATCH] mmux: mmio: fix IS_ERR() vs NULL check for mux_mmio_probe()

From: Krzysztof Kozlowski
Date: Thu Dec 25 2025 - 07:08:19 EST


On 25/12/2025 12:41, Alper Ak wrote:
> devm_kmalloc() returns NULL on failure, not an ERR_PTR value. The
> current IS_ERR() check will never catch allocation failures, which
> could lead to NULL pointer dereference.
>
> Signed-off-by: Alper Ak <alperyasinak1@xxxxxxxxx>

Missing fixes tag.

> ---
> drivers/mux/mmio.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c
> index e4ddb1e61923..3409af1ffb80 100644
> --- a/drivers/mux/mmio.c
> +++ b/drivers/mux/mmio.c
> @@ -101,13 +101,13 @@ static int mux_mmio_probe(struct platform_device *pdev)
> mux_mmio = mux_chip_priv(mux_chip);
>
> mux_mmio->fields = devm_kmalloc(dev, num_fields * sizeof(*mux_mmio->fields), GFP_KERNEL);
> - if (IS_ERR(mux_mmio->fields))
> - return PTR_ERR(mux_mmio->fields);

I really wonder from where do the people sometimes copy code...

With missing tag:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>

Best regards,
Krzysztof