lkml.org 
[lkml]   [2018]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.16 204/366] net/mlx5: Fix incorrect raw command length parsing
    3.16.61-rc1 review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Alex Vesker <valex@mellanox.com>

    commit 603b7bcff824740500ddfa001d7a7168b0b38542 upstream.

    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>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 4 +---
    1 file changed, 1 insertion(+), 3 deletions(-)

    --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
    +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
    @@ -1028,7 +1028,7 @@ static ssize_t outlen_write(struct file
    {
    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;
    @@ -1043,8 +1043,6 @@ static ssize_t outlen_write(struct file
    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;
    \
     
     \ /
      Last update: 2018-11-11 21:19    [W:4.026 / U:0.496 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site