OSDN Git Service

net/mlx5: Fix uninitialized variable bug in outlen_write()
authorYueHaibing <yuehaibing@huawei.com>
Mon, 21 Nov 2022 11:22:04 +0000 (19:22 +0800)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 24 Nov 2022 08:03:21 +0000 (00:03 -0800)
commit3f5769a074c13d8f08455e40586600419e02a880
treee3096929b66f2e9bdbc3ce4a57b253c9e3c8764c
parente87c6a832f889c093c055a30a7b8c6843e6573bf
net/mlx5: Fix uninitialized variable bug in outlen_write()

If sscanf() return 0, outlen is uninitialized and used in kzalloc(),
this is unexpected. We should return -EINVAL if the string is invalid.

Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/cmd.c