[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CY8PR11MB7134B471F7005E5F7798ABAA89D4A@CY8PR11MB7134.namprd11.prod.outlook.com>
Date: Thu, 20 Nov 2025 07:30:03 +0000
From: "Zhuo, Qiuxu" <qiuxu.zhuo@...el.com>
To: Haotian Zhang <vulab@...as.ac.cn>, "Luck, Tony" <tony.luck@...el.com>,
"bp@...en8.de" <bp@...en8.de>
CC: "linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] ras: cec: Fix debugfs error checking
> From: Haotian Zhang <vulab@...as.ac.cn>
> Sent: Thursday, November 20, 2025 11:02 AM
> To: Luck, Tony <tony.luck@...el.com>; bp@...en8.de
> Cc: linux-edac@...r.kernel.org; linux-kernel@...r.kernel.org; Haotian Zhang
> <vulab@...as.ac.cn>
> Subject: [PATCH] ras: cec: Fix debugfs error checking
>
> The debugfs_create_dir() and debugfs_create_file() functions return
> ERR_PTR() on error, not NULL. The current null-checks fail to detect errors
> because ERR_PTR() encodes error codes as non-null pointer values.
>
> Replace the null-checks with IS_ERR() for all debugfs_create_dir() and
> debugfs_create_file() calls to properly handle errors.
>
> Fixes: 011d82611172 ("RAS: Add a Corrected Errors Collector")
> Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
> ---
> [...]
I just quickly found that there are at least two more that need these similar fixes:
Maybe you can add these missing fixes to your patch as well.
diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index e440b15fbabc..9f6626380ea2 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -483,7 +483,7 @@ static int __init create_debugfs_nodes(void)
struct dentry *d, *pfn, *decay, *count, *array, *dfs;
dfs = ras_get_debugfs_root();
- if (!dfs) {
+ if (IS_ERR(dfs)) {
pr_warn("Error getting RAS debugfs root!\n");
return -1;
}
diff --git a/drivers/ras/debugfs.c b/drivers/ras/debugfs.c
index 42afd3de68b2..8f817bd9cb09 100644
--- a/drivers/ras/debugfs.c
+++ b/drivers/ras/debugfs.c
@@ -47,7 +47,7 @@ int __init ras_add_daemon_trace(void)
{
struct dentry *fentry;
- if (!ras_debugfs_dir)
+ if (IS_ERR(ras_debugfs_dir))
return -ENOENT;
fentry = debugfs_create_file("daemon_active", S_IRUSR, ras_debugfs_dir,
Powered by blists - more mailing lists