Skip to contentSkip to conversation

RDMA/mlx5: Signedness bug in UVERBS_HANDLER()

PATCH Applied Dan Carpenter 3 participants 3 messages Dec 22, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/mlx5: Signedness bug in UVERBS_HANDLER()

The "num_actions" variable needs to be signed for the error handling to work. The maximum number of actions is less than 256 so int type is large enough for that.

Fixes cbfdd442c43e ("IB/uverbs: Add helper to get array size from ptr attribute")
---
 drivers/infiniband/hw/mlx5/flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/flow.c +1 -1
index 95cf4b9fc65d..e8a1e4498e3f 100644
@@ -329,7 +329,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_FLOW_ACTION_CREATE_MODIFY_HEADER)(
 	struct mlx5_ib_dev *mdev = to_mdev(uobj->context->device);
 	enum mlx5_ib_uapi_flow_table_type ft_type;
 	struct ib_flow_action *action;
-	size_t num_actions;
+	int num_actions;
 	void *in;
 	int ret;
 
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Dan Carpenter

The "num_actions" variable needs to be signed for the error handling to work. The maximum number of actions is less than 256 so int type is large enough for that.

Fixes cbfdd442c43e ("IB/uverbs: Add helper to get array size from ptr attribute")
---
 drivers/infiniband/hw/mlx5/flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,

#2 lore raw
In reply to Dan Carpenter
Quoted 10 lines · Dan Carpenter

The "num_actions" variable needs to be signed for the error handling to work. The maximum number of actions is less than 256 so int type is large enough for that.

Fixes cbfdd442c43e ("IB/uverbs: Add helper to get array size from ptr attribute")
---
 drivers/infiniband/hw/mlx5/flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next

Thanks,
Jason