All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>,
	"David S. Miller" <davem@davemloft.net>,
	Boris Pismenny <borisp@mellanox.com>,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH v2] net/mlx5e: Refactor switch statements to avoid using uninitialized variables
Date: Wed, 10 Jul 2019 08:22:19 +0300	[thread overview]
Message-ID: <20190710052219.GC7034@mtr-leonro.mtl.com> (raw)
In-Reply-To: <20190710044748.3924-1-natechancellor@gmail.com>

On Tue, Jul 09, 2019 at 09:47:49PM -0700, Nathan Chancellor wrote:
> clang warns:
>
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c:251:2:
> warning: variable 'rec_seq_sz' is used uninitialized whenever switch
> default is taken [-Wsometimes-uninitialized]
>         default:
>         ^~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c:255:46: note:
> uninitialized use occurs here
>         skip_static_post = !memcmp(rec_seq, &rn_be, rec_seq_sz);
>                                                     ^~~~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c:239:16: note:
> initialize the variable 'rec_seq_sz' to silence this warning
>         u16 rec_seq_sz;
>                       ^
>                        = 0
> 1 warning generated.
>
> The default case statement should return in tx_post_resync_params like
> in fill_static_params_ctx. However, as Nick and Leon point out, the
> switch statements converted into if statements to clean up the code a
> bit since there is only one cipher supported. Do that to clear up the
> code.
>
> Fixes: d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support")
> Link: https://github.com/ClangBuiltLinux/linux/issues/590
> Suggested-by: Leon Romanovsky <leon@kernel.org>
> Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>
> v1 -> v2:
>
> * Refactor switch statements into if statements
>
>  .../mellanox/mlx5/core/en_accel/ktls_tx.c     | 33 +++++++------------
>  1 file changed, 11 insertions(+), 22 deletions(-)
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

  reply	other threads:[~2019-07-10  5:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08 23:11 [PATCH] net/mlx5e: Return in default case statement in tx_post_resync_params Nathan Chancellor
2019-07-09 22:44 ` Nick Desaulniers
2019-07-09 23:10   ` Nathan Chancellor
2019-07-10  4:24     ` Leon Romanovsky
2019-07-10  4:47 ` [PATCH v2] net/mlx5e: Refactor switch statements to avoid using uninitialized variables Nathan Chancellor
2019-07-10  5:22   ` Leon Romanovsky [this message]
2019-07-10  5:36   ` David Miller
2019-07-10  5:57     ` Nathan Chancellor
2019-07-10  6:06   ` [PATCH net-next v3] net/mlx5e: Convert single case statement switch statements into if statements Nathan Chancellor
2019-07-10  9:31     ` Leon Romanovsky
2019-07-12 18:37     ` David Miller

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=20190710052219.GC7034@mtr-leonro.mtl.com \
    --to=leon@kernel.org \
    --cc=borisp@mellanox.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.