2023-07-12 13:35:46

by Wang Ming

[permalink] [raw]
Subject: [PATCH v2] net:Fix an NULL vs IS_ERR() bug for debugfs_create_dir() in i40e_dbg_init()

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]>
---
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-12 21:12:10

by Tony Nguyen

[permalink] [raw]
Subject: Re: [PATCH v2] net:Fix an NULL vs IS_ERR() bug for debugfs_create_dir() in i40e_dbg_init()

On 7/12/2023 5:19 AM, Wang Ming wrote:

Please designate a tree for the patch (net or net-next) [1].

If you could include the driver (i40e) in the commit title as well.
Also, a nit, but the title is a bit long, seems like it could be a bit
more succinct.

> 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.

As it's a fix, there should be a Fixes tag as well.

> Signed-off-by: Wang Ming <[email protected]>
> ---
> 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");
> }
>

[1]
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#netdev-faq

2023-07-13 01:35:59

by Wang Ming

[permalink] [raw]
Subject: 回复: [PATCH v2] net:Fix an NULL vs IS_ERR( ) bug for debugfs_create_dir() in i40e_dbg_in it()

okay, I'm following your advice and resubmitting

-----邮件原件-----
发件人: Tony Nguyen <[email protected]>
发送时间: 2023年7月13日 4:57
收件人: 王明-软件底层技术部 <[email protected]>; Jesse Brandeburg <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; [email protected]; [email protected]
抄送: opensource.kernel <[email protected]>
主题: Re: [PATCH v2] net:Fix an NULL vs IS_ERR() bug for debugfs_create_dir() in i40e_dbg_init()

On 7/12/2023 5:19 AM, Wang Ming wrote:

Please designate a tree for the patch (net or net-next) [1].

If you could include the driver (i40e) in the commit title as well.
Also, a nit, but the title is a bit long, seems like it could be a bit more succinct.

> 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.

As it's a fix, there should be a Fixes tag as well.

> Signed-off-by: Wang Ming <[email protected]>
> ---
> 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");
> }
>

[1]
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#netdev-faq

2023-07-13 02:15:16

by Wang Ming

[permalink] [raw]
Subject: 回复: [PATCH v2] net:Fix an NULL vs IS_ERR( ) bug for debugfs_create_dir() in i40e_dbg_in it()

Hi Tony Nguyen
good morning, I have resubmitted patch according to your requirements, please review it when you are free, I will be very grateful.
????
Regards,
Wang Ming
-----邮件原件-----
发件人: Tony Nguyen <[email protected]>
发送时间: 2023年7月13日 4:57
收件人: 王明-软件底层技术部 <[email protected]>; Jesse Brandeburg <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; [email protected]; [email protected]
抄送: opensource.kernel <[email protected]>
主题: Re: [PATCH v2] net:Fix an NULL vs IS_ERR() bug for debugfs_create_dir() in i40e_dbg_init()

On 7/12/2023 5:19 AM, Wang Ming wrote:

Please designate a tree for the patch (net or net-next) [1].

If you could include the driver (i40e) in the commit title as well.
Also, a nit, but the title is a bit long, seems like it could be a bit more succinct.

> 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.

As it's a fix, there should be a Fixes tag as well.

> Signed-off-by: Wang Ming <[email protected]>
> ---
> 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");
> }
>

[1]
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#netdev-faq