On Fri, Nov 08, 2013 at 12:52:59PM +0300, Dan Carpenter wrote:
> "page_size" is declared as u64 but the (1 << page_shift) shift will wrap
> at 32 bits.
I hope to live when this happnes :-)
I prefer to be explicit and use:
page_size = (u64)1 << page_shift;
>
> Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
> Signed-off-by: Dan Carpenter <[email protected]>
>
> diff --git a/drivers/infiniband/hw/mlx5/mem.c
> b/drivers/infiniband/hw/mlx5/mem.c
> index 3a53228..3020ec2 100644
> --- a/drivers/infiniband/hw/mlx5/mem.c
> +++ b/drivers/infiniband/hw/mlx5/mem.c
> @@ -148,7 +148,7 @@ int mlx5_ib_get_buf_offset(u64 addr, int page_shift, u32
> *offset)
> u64 off_mask;
> u64 buf_off;
>
> - page_size = 1 << page_shift;
> + page_size = 1ULL << page_shift;
> page_mask = page_size - 1;
> buf_off = addr & page_mask;
> off_size = page_size >> 6;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html