Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 718973a3 authored by Alex Vesker's avatar Alex Vesker Committed by Greg Kroah-Hartman
Browse files

net/mlx5: Fix incorrect raw command length parsing



[ Upstream commit 603b7bcff824740500ddfa001d7a7168b0b38542 ]

The NULL character was not set correctly for the string containing
the command length, this caused failures reading the output of the
command due to a random length. The fix is to initialize the output
length string.

Fixes: e126ba97 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Signed-off-by: default avatarAlex Vesker <valex@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9e2b2995
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -933,7 +933,7 @@ static ssize_t outlen_write(struct file *filp, const char __user *buf,
{
	struct mlx5_core_dev *dev = filp->private_data;
	struct mlx5_cmd_debug *dbg = &dev->cmd.dbg;
	char outlen_str[8];
	char outlen_str[8] = {0};
	int outlen;
	void *ptr;
	int err;
@@ -948,8 +948,6 @@ static ssize_t outlen_write(struct file *filp, const char __user *buf,
	if (copy_from_user(outlen_str, buf, count))
		return -EFAULT;

	outlen_str[7] = 0;

	err = sscanf(outlen_str, "%d", &outlen);
	if (err < 0)
		return err;