Re: [PATCH 01/10] EDAC/altera: Fix NULL of_node dereference altr_edac_device_probe()
From: Dinh Nguyen
Date: Fri Jul 31 2026 - 09:50:31 EST
On 7/28/26 13:56, Borislav Petkov wrote:
On Mon, Jul 27, 2026 at 08:24:07AM -0500, Dinh Nguyen wrote:
In altr_edac_device_probe() dereferenced pdev->dev.of_node and
of_match_node() before validating it,
How did that AI let you fumble that sentence? :-P
sorry about that...
which could cause a NULL pointer
dereference when the device tree node is missing. Check the result for
a NULL and bail out with -ENODEV before using it.
Assisted-by: Cursor:claude-4.8-opus
Fixes: c3eea1942a16 ("EDAC, altera: Add Altera L2 cache and OCRAM support")
Closes: https://sashiko.dev/#/patchset/20260719211238.589402-1-rosenp%40gmail.com
So the AI review for this one here is this one, I think:
"This isn't a bug introduced by this patch, but can np be NULL here if the
driver is bound via sysfs?
If a privileged user unbinds and rebinds the driver via sysfs to a platform
device that lacks an of_node, pdev->dev.of_node will be NULL, which would
cause an unconditional dereference when accessing np->name."
Can that happen?
I don't think this can ever happen. The SoCFPGA platform is strictly OF enabled, so not having an of_node would be impossible.
Let me rework this down some more. Sorry for the noise!
Dinh