From: Nick Desaulniers <ndesaulniers@google.com>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>,
Leon Romanovsky <leon@kernel.org>,
Network Development <netdev@vger.kernel.org>,
linux-rdma@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: [PATCH] mlx5: Remove uninitialized use of key in mlx5_core_create_mkey
Date: Mon, 16 Mar 2020 13:55:55 -0700 [thread overview]
Message-ID: <CAKwvOdkDUYYm9ZoTeKt-5kGhDTxo6w2XhOjONWhzh6M4rE5LpA@mail.gmail.com> (raw)
In-Reply-To: <20200316203452.32998-1-natechancellor@gmail.com>
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
next prev parent reply other threads:[~2020-03-16 20:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2020-03-17 6:36 ` Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKwvOdkDUYYm9ZoTeKt-5kGhDTxo6w2XhOjONWhzh6M4rE5LpA@mail.gmail.com \
--to=ndesaulniers@google.com \
--cc=clang-built-linux@googlegroups.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=natechancellor@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).