linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mlx5: Remove uninitialized use of key in mlx5_core_create_mkey
@ 2020-03-16 20:34 Nathan Chancellor
  2020-03-16 20:55 ` Nick Desaulniers
  2020-03-17  6:36 ` Saeed Mahameed
  0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2020-03-16 20:34 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky
  Cc: netdev, linux-rdma, linux-kernel, clang-built-linux, Nathan Chancellor

Clang warns:

../drivers/net/ethernet/mellanox/mlx5/core/mr.c:63:21: warning: variable
'key' is uninitialized when used here [-Wuninitialized]
                      mkey_index, key, mkey->key);
                                  ^~~
../drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h:54:6: note:
expanded from macro 'mlx5_core_dbg'
                 ##__VA_ARGS__)
                   ^~~~~~~~~~~
../include/linux/dev_printk.h:114:39: note: expanded from macro
'dev_dbg'
        dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                             ^~~~~~~~~~~
../include/linux/dynamic_debug.h:158:19: note: expanded from macro
'dynamic_dev_dbg'
                           dev, fmt, ##__VA_ARGS__)
                                       ^~~~~~~~~~~
../include/linux/dynamic_debug.h:143:56: note: expanded from macro
'_dynamic_func_call'
        __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
                                                              ^~~~~~~~~~~
../include/linux/dynamic_debug.h:125:15: note: expanded from macro
'__dynamic_func_call'
                func(&id, ##__VA_ARGS__);               \
                            ^~~~~~~~~~~
../drivers/net/ethernet/mellanox/mlx5/core/mr.c:47:8: note: initialize
the variable 'key' to silence this warning
        u8 key;
              ^
               = '\0'
1 warning generated.

key's initialization was removed in commit fc6a9f86f08a ("{IB,net}/mlx5:
Assign mkey variant in mlx5_ib only") but its use was not fully removed.
Remove it now so that there is no more warning.

Fixes: fc6a9f86f08a ("{IB,net}/mlx5: Assign mkey variant in mlx5_ib only")
Link: https://github.com/ClangBuiltLinux/linux/issues/932
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/mr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mr.c b/drivers/net/ethernet/mellanox/mlx5/core/mr.c
index fd3e6d217c3b..366f2cbfc6db 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/mr.c
@@ -44,7 +44,6 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
 	u32 mkey_index;
 	void *mkc;
 	int err;
-	u8 key;
 
 	MLX5_SET(create_mkey_in, in, opcode, MLX5_CMD_OP_CREATE_MKEY);
 
@@ -59,8 +58,7 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
 	mkey->key |= mlx5_idx_to_mkey(mkey_index);
 	mkey->pd = MLX5_GET(mkc, mkc, pd);
 
-	mlx5_core_dbg(dev, "out 0x%x, key 0x%x, mkey 0x%x\n",
-		      mkey_index, key, mkey->key);
+	mlx5_core_dbg(dev, "out 0x%x, mkey 0x%x\n", mkey_index, mkey->key);
 	return 0;
 }
 EXPORT_SYMBOL(mlx5_core_create_mkey);
-- 
2.26.0.rc1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mlx5: Remove uninitialized use of key in mlx5_core_create_mkey
  2020-03-16 20:34 [PATCH] mlx5: Remove uninitialized use of key in mlx5_core_create_mkey Nathan Chancellor
@ 2020-03-16 20:55 ` Nick Desaulniers
  2020-03-17  6:36 ` Saeed Mahameed
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Desaulniers @ 2020-03-16 20:55 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Saeed Mahameed, Leon Romanovsky, Network Development, linux-rdma,
	LKML, clang-built-linux

On Mon, Mar 16, 2020 at 1:35 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns:
>
> ../drivers/net/ethernet/mellanox/mlx5/core/mr.c:63:21: warning: variable
> 'key' is uninitialized when used here [-Wuninitialized]
>                       mkey_index, key, mkey->key);
>                                   ^~~
> ../drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h:54:6: note:
> expanded from macro 'mlx5_core_dbg'
>                  ##__VA_ARGS__)
>                    ^~~~~~~~~~~
> ../include/linux/dev_printk.h:114:39: note: expanded from macro
> 'dev_dbg'
>         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
>                                              ^~~~~~~~~~~
> ../include/linux/dynamic_debug.h:158:19: note: expanded from macro
> 'dynamic_dev_dbg'
>                            dev, fmt, ##__VA_ARGS__)
>                                        ^~~~~~~~~~~
> ../include/linux/dynamic_debug.h:143:56: note: expanded from macro
> '_dynamic_func_call'
>         __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
>                                                               ^~~~~~~~~~~
> ../include/linux/dynamic_debug.h:125:15: note: expanded from macro
> '__dynamic_func_call'
>                 func(&id, ##__VA_ARGS__);               \
>                             ^~~~~~~~~~~
> ../drivers/net/ethernet/mellanox/mlx5/core/mr.c:47:8: note: initialize
> the variable 'key' to silence this warning
>         u8 key;
>               ^
>                = '\0'
> 1 warning generated.
>
> key's initialization was removed in commit fc6a9f86f08a ("{IB,net}/mlx5:
> Assign mkey variant in mlx5_ib only") but its use was not fully removed.
> Remove it now so that there is no more warning.
>
> Fixes: fc6a9f86f08a ("{IB,net}/mlx5: Assign mkey variant in mlx5_ib only")
> Link: https://github.com/ClangBuiltLinux/linux/issues/932
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Thanks for the patch and analysis, looks good to me!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  drivers/net/ethernet/mellanox/mlx5/core/mr.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mr.c b/drivers/net/ethernet/mellanox/mlx5/core/mr.c
> index fd3e6d217c3b..366f2cbfc6db 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/mr.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/mr.c
> @@ -44,7 +44,6 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
>         u32 mkey_index;
>         void *mkc;
>         int err;
> -       u8 key;
>
>         MLX5_SET(create_mkey_in, in, opcode, MLX5_CMD_OP_CREATE_MKEY);
>
> @@ -59,8 +58,7 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
>         mkey->key |= mlx5_idx_to_mkey(mkey_index);
>         mkey->pd = MLX5_GET(mkc, mkc, pd);
>
> -       mlx5_core_dbg(dev, "out 0x%x, key 0x%x, mkey 0x%x\n",
> -                     mkey_index, key, mkey->key);
> +       mlx5_core_dbg(dev, "out 0x%x, mkey 0x%x\n", mkey_index, mkey->key);
>         return 0;
>  }
>  EXPORT_SYMBOL(mlx5_core_create_mkey);
> --
> 2.26.0.rc1
>
> --

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mlx5: Remove uninitialized use of key in mlx5_core_create_mkey
  2020-03-16 20:34 [PATCH] mlx5: Remove uninitialized use of key in mlx5_core_create_mkey Nathan Chancellor
  2020-03-16 20:55 ` Nick Desaulniers
@ 2020-03-17  6:36 ` Saeed Mahameed
  1 sibling, 0 replies; 3+ messages in thread
From: Saeed Mahameed @ 2020-03-17  6:36 UTC (permalink / raw)
  To: natechancellor, leon; +Cc: clang-built-linux, netdev, linux-rdma, linux-kernel

On Mon, 2020-03-16 at 13:34 -0700, Nathan Chancellor wrote:
> Clang warns:
> 
> ../drivers/net/ethernet/mellanox/mlx5/core/mr.c:63:21: warning:
> variable
> 'key' is uninitialized when used here [-Wuninitialized]
>                       mkey_index, key, mkey->key);
>                                   ^~~
> ../drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h:54:6: note:
> expanded from macro 'mlx5_core_dbg'
>                  ##__VA_ARGS__)
>                    ^~~~~~~~~~~
> ../include/linux/dev_printk.h:114:39: note: expanded from macro
> 'dev_dbg'
>         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
>                                              ^~~~~~~~~~~
> ../include/linux/dynamic_debug.h:158:19: note: expanded from macro
> 'dynamic_dev_dbg'
>                            dev, fmt, ##__VA_ARGS__)
>                                        ^~~~~~~~~~~
> ../include/linux/dynamic_debug.h:143:56: note: expanded from macro
> '_dynamic_func_call'
>         __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func,
> ##__VA_ARGS__)
>                                                               ^~~~~~~
> ~~~~
> ../include/linux/dynamic_debug.h:125:15: note: expanded from macro
> '__dynamic_func_call'
>                 func(&id, ##__VA_ARGS__);               \
>                             ^~~~~~~~~~~
> ../drivers/net/ethernet/mellanox/mlx5/core/mr.c:47:8: note:
> initialize
> the variable 'key' to silence this warning
>         u8 key;
>               ^
>                = '\0'
> 1 warning generated.
> 
> key's initialization was removed in commit fc6a9f86f08a
> ("{IB,net}/mlx5:
> Assign mkey variant in mlx5_ib only") but its use was not fully
> removed.
> Remove it now so that there is no more warning.
> 
> Fixes: fc6a9f86f08a ("{IB,net}/mlx5: Assign mkey variant in mlx5_ib
> only")
> Link: https://github.com/ClangBuiltLinux/linux/issues/932
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> 

LGTM

applied to mlx5-next

Thanks,
Saeed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-17  6:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-16 20:34 [PATCH] mlx5: Remove uninitialized use of key in mlx5_core_create_mkey Nathan Chancellor
2020-03-16 20:55 ` Nick Desaulniers
2020-03-17  6:36 ` Saeed Mahameed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).