OSDN Git Service

RDMA/uverbs: Don't overwrite NULL pointer with ZERO_SIZE_PTR
authorLeon Romanovsky <leonro@mellanox.com>
Sun, 24 Jun 2018 08:23:47 +0000 (11:23 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Oct 2018 23:59:13 +0000 (16:59 -0700)
commit53b56e401d930d9d0ae148975c5c34f46df27b11
treeb25d97fd0b81ca99fec7cf9d76f4efa096e64044
parent1da59841eea9bd521e1b42cb7b7eece12247019e
RDMA/uverbs: Don't overwrite NULL pointer with ZERO_SIZE_PTR

[ Upstream commit a5cc9831af05e658543593abaee45a29d061bac4 ]

Number of specs is provided by user and in valid case can be equal to zero.
Such argument causes to call to kcalloc() with zero-length request and in
return the ZERO_SIZE_PTR is assigned. This pointer is different from NULL
and makes various if (..) checks to success.

Fixes: b6ba4a9aa59f ("IB/uverbs: Add support for flow counters")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/uverbs_cmd.c