[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7194164e-5715-436e-8093-64f3742cf5f1@lunn.ch>
Date: Tue, 1 Apr 2025 16:36:00 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Henry Martin <bsdhenrymartin@...il.com>
Cc: m.grzeschik@...gutronix.de, andrew+netdev@...n.ch, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] arcnet: Add NULL check in com20020pci_probe()
On Tue, Apr 01, 2025 at 09:49:03PM +0800, Henry Martin wrote:
> devm_kasprintf() returns NULL when memory allocation fails. Currently,
> com20020pci_probe() does not check for this case, which results in a
> NULL pointer dereference.
>
> Add NULL check after devm_kasprintf() to prevent this issue.
It is more normal to add a test after each devm_kasprintf() rather
than one big one at the end. If the first fails, all the others are
going to fail as well, so you should not bother and just fail the
probe.
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
Andrew
---
pw-bot: cr
Powered by blists - more mailing lists