From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>,
Alex Vesker <valex@mellanox.com>,
Saeed Mahameed <saeedm@mellanox.com>
Subject: [net 8/9] net/mlx5: Fix incorrect raw command length parsing
Date: Tue, 26 Jun 2018 17:21:17 -0700 [thread overview]
Message-ID: <20180627002118.9856-9-saeedm@mellanox.com> (raw)
In-Reply-To: <20180627002118.9856-1-saeedm@mellanox.com>
From: Alex Vesker <valex@mellanox.com>
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: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Signed-off-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index 487388aed98f..2db5fe571594 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -1276,7 +1276,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;
@@ -1291,8 +1291,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;
--
2.17.0
next prev parent reply other threads:[~2018-06-27 0:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-27 0:21 [pull request][net 0/9] Mellanox, mlx5 fixes 2018-06-26 Saeed Mahameed
2018-06-27 0:21 ` [net 1/9] net/mlx5e: Don't attempt to dereference the ppriv struct if not being eswitch manager Saeed Mahameed
2018-06-27 0:21 ` [net 2/9] net/mlx5: E-Switch, Avoid setup attempt if not being e-switch manager Saeed Mahameed
2018-06-27 0:21 ` [net 3/9] net/mlx5e: Avoid dealing with vport representors " Saeed Mahameed
2018-06-27 0:21 ` [net 4/9] IB/mlx5: " Saeed Mahameed
2018-06-27 0:21 ` [net 5/9] net/mlx5: E-Switch, Disallow vlan/spoofcheck setup if not being esw manager Saeed Mahameed
2018-06-27 0:21 ` [net 6/9] net/mlx5: Fix required capability for manipulating MPFS Saeed Mahameed
2018-06-27 0:21 ` [net 7/9] net/mlx5: Fix wrong size allocation for QoS ETC TC regitster Saeed Mahameed
2018-06-27 0:21 ` Saeed Mahameed [this message]
2018-06-27 0:21 ` [net 9/9] net/mlx5: Fix command interface race in polling mode Saeed Mahameed
2018-06-28 7:57 ` [pull request][net 0/9] Mellanox, mlx5 fixes 2018-06-26 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180627002118.9856-9-saeedm@mellanox.com \
--to=saeedm@mellanox.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=valex@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox