net/mlx5: Fix uninitialized variable bug in outlen_write()
authorYueHaibing <yuehaibing@huawei.com>
Mon, 21 Nov 2022 11:22:04 +0000 (19:22 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Dec 2022 10:28:40 +0000 (11:28 +0100)
commit839eeab03c831a52333f7e9737685742a2c0cc1d
tree50dff6bae2fb66e8ca751f89457724417e807f5e
parent34feea3bfb37e09b20b9891ad72a815ac7895bd8
net/mlx5: Fix uninitialized variable bug in outlen_write()

[ Upstream commit 3f5769a074c13d8f08455e40586600419e02a880 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/cmd.c