]> git.baikalelectronics.ru Git - kernel.git/commit
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:23:02 +0000 (11:23 +0100)
commit32420b9c9294726e567683a4a878ceb8263d7bab
treeb561f53289ba86532b5d98f9a7531a00618deafb
parent1f21cfdaece2d6a25a1859e23fc37bff53b5be11
net/mlx5: Fix uninitialized variable bug in outlen_write()

[ Upstream commit 3d9e9b991670f728f22901b08808cd1732bb5964 ]

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

Fixes: ffaf2c1a3989 ("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