]> git.baikalelectronics.ru Git - kernel.git/commit
IB/core: Split uverbs_get_const/default to consider target type
authorYishai Hadas <yishaih@nvidia.com>
Thu, 4 Mar 2021 13:05:00 +0000 (15:05 +0200)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 12 Mar 2021 00:20:36 +0000 (20:20 -0400)
commitc3de9419125dec6c63410bfc3916d70594453b3e
tree13b31401b907cc38deebf0327e1ab35d76b40c66
parentfa077c65a75c9dd7040212dca075082fba246084
IB/core: Split uverbs_get_const/default to consider target type

Change uverbs_get_const/uverbs_get_const_default to work properly with
both signed/unsigned parameters.

Current APIs mix s64 and u64 which leads to incorrect check when u64
value was supplied and its upper bit was set. In that case
uverbs_get_const() / uverbs_get_const_default() lower bound check may
fail unexpectedly, target is unsigned (lower bound is 0) but value
became negative as of the s64 usage.

Split to have two different APIs, no change to callers as the required
API will be called internally according to the target type.

Link: https://lore.kernel.org/r/20210304130501.1102577-3-leon@kernel.org
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/uverbs_ioctl.c
drivers/infiniband/hw/mlx5/main.c
include/rdma/uverbs_ioctl.h