]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5e: Return in default case statement in tx_post_resync_params
authorNathan Chancellor <natechancellor@gmail.com>
Mon, 8 Jul 2019 23:11:55 +0000 (16:11 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Jul 2019 04:40:20 +0000 (21:40 -0700)
commita543bf7e0068a9a2977adb42ed64dba66e0effae
tree059d29f3f5346b0cee0207da6cfaa1beec08d576
parent5fbcc7713c62bdf7a2edf746be41fdc09c576585
net/mlx5e: Return in default case statement in tx_post_resync_params

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.

This case statement was clearly designed to be one that should not be
hit during runtime because of the WARN_ON statement so just return early
to prevent copying uninitialized memory up into rn_be.

Fixes: 78c1118ca47b ("net/mlx5e: Add kTLS TX HW offload support")
Link: https://github.com/ClangBuiltLinux/linux/issues/590
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c