]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/mlx5: Prevent overflow in mmap offset calculations
authorLeon Romanovsky <leonro@mellanox.com>
Wed, 12 Feb 2020 07:26:35 +0000 (09:26 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 13 Feb 2020 14:39:23 +0000 (10:39 -0400)
commit8412553bf30813388ae02d5528efc5c47e1278ae
tree2dd5eb3eabf24c6a922a8649c6acf9e9e5410c26
parent193b58cb498918fbf1da5b78b20fd1289d2253a0
RDMA/mlx5: Prevent overflow in mmap offset calculations

The cmd and index variables declared as u16 and the result is supposed to
be stored in u64. The C arithmetic rules doesn't promote "(index >> 8) <<
16" to be u64 and leaves the end result to be u16.

Fixes: 4ac23e668422 ("IB/mlx5: Introduce VAR object and its alloc/destroy methods")
Link: https://lore.kernel.org/r/20200212072635.682689-10-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx5/main.c