]> git.baikalelectronics.ru Git - kernel.git/commit
IB/mlx4: Potential buffer overflow in _mlx4_set_path()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 5 Dec 2017 14:39:23 +0000 (17:39 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 13 Dec 2017 18:00:14 +0000 (11:00 -0700)
commitd93aade5f90e344633f343baa970cb05aa88b09e
tree1d17148a7f7f7c0c1a5103cdd9f6cd455d81ceb7
parent725d07894ce183cbd633227d2754a78e6d8e9bc7
IB/mlx4: Potential buffer overflow in _mlx4_set_path()

Smatch complains about this code:

    drivers/infiniband/hw/mlx4/qp.c:1827 _mlx4_set_path()
    error: buffer overflow 'dev->dev->caps.gid_table_len' 3 <= 255

The mlx4_ib_gid_index_to_real_index() does check that "port" is within
bounds, but we don't check the return value for errors.  It seems simple
enough to add a check for that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx4/qp.c