2023-07-13 02:18:24

by Wang Ming

[permalink] [raw]
Subject: [PATCH net v1] i40e:Fix an NULL vs IS_ERR() bug for debugfs_create_dir()

The debugfs_create_dir() function returns error pointers.
It never returns NULL. Most incorrect error checks were fixed,
but the one in i40e_dbg_init() was forgotten.

Fix the remaining error check.

Signed-off-by: Wang Ming <[email protected]>

Fixes: 02e9c290814c ("i40e: debugfs interface")
---
drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index 9954493cd448..62497f5565c5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -1839,7 +1839,7 @@ void i40e_dbg_pf_exit(struct i40e_pf *pf)
void i40e_dbg_init(void)
{
i40e_dbg_root = debugfs_create_dir(i40e_driver_name, NULL);
- if (!i40e_dbg_root)
+ if (IS_ERR(i40e_dbg_root))
pr_info("init of debugfs failed\n");
}

--
2.25.1



2023-07-18 05:41:34

by Pucha, HimasekharX Reddy

[permalink] [raw]
Subject: RE: [Intel-wired-lan] [PATCH net v1] i40e:Fix an NULL vs IS_ERR() bug for debugfs_create_dir()

> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf Of Wang Ming
> Sent: Thursday, July 13, 2023 7:13 AM
> To: Brandeburg, Jesse <[email protected]>; Nguyen, Anthony L <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Shannon Nelson <[email protected]>; Jeff Kirsher <[email protected]>; [email protected]; [email protected]; [email protected]
> Cc: Wang Ming <[email protected]>; [email protected]
> Subject: [Intel-wired-lan] [PATCH net v1] i40e:Fix an NULL vs IS_ERR() bug for debugfs_create_dir()
>
> The debugfs_create_dir() function returns error pointers.
> It never returns NULL. Most incorrect error checks were fixed, but the one in i40e_dbg_init() was forgotten.
>
> Fix the remaining error check.
>
> Signed-off-by: Wang Ming <[email protected]>
>
> Fixes: 02e9c290814c ("i40e: debugfs interface")
> ---
> drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel)