* [PATCH 0/1] EDAC/altera: Guard against NULL of_node
@ 2026-08-06 16:10 Dinh Nguyen
2026-08-06 16:10 ` [PATCH 1/1] EDAC/altera: Guard against NULL of_node pointer dereference Dinh Nguyen
2026-08-06 18:16 ` [PATCH 0/1] EDAC/altera: Guard against NULL of_node Borislav Petkov
0 siblings, 2 replies; 3+ messages in thread
From: Dinh Nguyen @ 2026-08-06 16:10 UTC (permalink / raw)
To: bp, tony.luck
Cc: dinguyen, rounakdas2025, niravkumar.l.rabara, linux-edac,
linux-kernel
Hi EDAC maintainers,
I wanted to explain the reason why I think this patch doesn't need a
Fixes tag. The way the Altera EDAC is written there are many instances
of the driver referencing the of_node, which is why they are flagged in
many sashiko reviews.
This patch checks for those NULL of_node in the probe functions using
dev_of_node() so we don't have to guard the of_node in all the other
functions.
The reason we don't need the Fixes tag is because this system is
supposed to run with CONFIG_OF enabled. The system would fail way
before it gets to this driver if an of_node is not found. Thus I don't
see a need for a Fixes tag but the guard should be in place for
completeness.
Thanks,
Dinh Nguyen (1):
EDAC/altera: Guard against NULL of_node pointer dereference
drivers/edac/altera_edac.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
--
2.42.0.411.g813d9a9188
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] EDAC/altera: Guard against NULL of_node pointer dereference
2026-08-06 16:10 [PATCH 0/1] EDAC/altera: Guard against NULL of_node Dinh Nguyen
@ 2026-08-06 16:10 ` Dinh Nguyen
2026-08-06 18:16 ` [PATCH 0/1] EDAC/altera: Guard against NULL of_node Borislav Petkov
1 sibling, 0 replies; 3+ messages in thread
From: Dinh Nguyen @ 2026-08-06 16:10 UTC (permalink / raw)
To: bp, tony.luck
Cc: dinguyen, rounakdas2025, niravkumar.l.rabara, linux-edac,
linux-kernel
There are many sashiko reports on this driver because it is using an
unusually high amount of functions that dereference an of_node pointer.
While you can guard the NULL pointer dereference in every function, it
would be much simpler to guard it during probe functions. This edac driver
is static, meaning it cannot add/remove nodes during runtime.
So it's best to use dev_of_node() in the probe functions, so if the of_node
is NULL, the driver would simply fail to load.
Closes: https://sashiko.dev/#/patchset/20260719211238.589402-1-rosenp%40gmail.com
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
---
drivers/edac/altera_edac.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index 68846f583eeef..f449bd45c5098 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -290,7 +290,7 @@ static int altr_sdram_probe(struct platform_device *pdev)
unsigned long mem_size, irqflags = 0;
/* Grab the register range from the sdr controller in device tree */
- mc_vbase = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+ mc_vbase = syscon_regmap_lookup_by_phandle(dev_of_node(&pdev->dev),
"altr,sdr-syscon");
if (IS_ERR(mc_vbase)) {
edac_printk(KERN_ERR, EDAC_MC,
@@ -507,9 +507,12 @@ MODULE_DEVICE_TABLE(of, altr_edac_of_match);
static int altr_edac_probe(struct platform_device *pdev)
{
- of_platform_populate(pdev->dev.of_node, altr_edac_device_of_match,
- NULL, &pdev->dev);
- return 0;
+ int ret;
+
+ ret = of_platform_populate(dev_of_node(&pdev->dev), altr_edac_device_of_match,
+ NULL, &pdev->dev);
+
+ return ret;
}
static struct platform_driver altr_edac_driver = {
@@ -2184,7 +2187,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
altr_edac_a10_irq_handler, edac);
}
- for_each_child_of_node(pdev->dev.of_node, child) {
+ for_each_child_of_node(dev_of_node(&pdev->dev), child) {
if (!of_device_is_available(child))
continue;
@@ -2193,7 +2196,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
#ifdef CONFIG_EDAC_ALTERA_SDRAM
else if (of_device_is_compatible(child, "altr,sdram-edac-a10"))
- of_platform_populate(pdev->dev.of_node,
+ of_platform_populate(dev_of_node(&pdev->dev),
altr_sdram_ctrl_of_match,
NULL, &pdev->dev);
#endif
--
2.42.0.411.g813d9a9188
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 0/1] EDAC/altera: Guard against NULL of_node
2026-08-06 16:10 [PATCH 0/1] EDAC/altera: Guard against NULL of_node Dinh Nguyen
2026-08-06 16:10 ` [PATCH 1/1] EDAC/altera: Guard against NULL of_node pointer dereference Dinh Nguyen
@ 2026-08-06 18:16 ` Borislav Petkov
1 sibling, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2026-08-06 18:16 UTC (permalink / raw)
To: Dinh Nguyen
Cc: tony.luck, rounakdas2025, niravkumar.l.rabara, linux-edac,
linux-kernel
On Thu, Aug 06, 2026 at 11:10:54AM -0500, Dinh Nguyen wrote:
> Hi EDAC maintainers,
>
> I wanted to explain the reason why I think this patch doesn't need a
> Fixes tag. The way the Altera EDAC is written there are many instances
> of the driver referencing the of_node, which is why they are flagged in
> many sashiko reviews.
If you think this patch would make your life easier, then sure. But
we're not "fixing" the code just because a tool is stupid. No matter which
tool it is.
Thx.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-06 18:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 16:10 [PATCH 0/1] EDAC/altera: Guard against NULL of_node Dinh Nguyen
2026-08-06 16:10 ` [PATCH 1/1] EDAC/altera: Guard against NULL of_node pointer dereference Dinh Nguyen
2026-08-06 18:16 ` [PATCH 0/1] EDAC/altera: Guard against NULL of_node Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox