Skip to contentSkip to conversation

RDMA/mlx5: unchecked return value

PATCH In review Sebin Sebastian 3 participants 3 messages Jul 30, 2022 – Aug 2, 2022

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

PATCH 1/1 RDMA/mlx5: unchecked return value

Unchecked return value warning as reported by Coverity static analyzer tool. check the return value of mlx5_ib_ft_type_to_namespace().

---
 drivers/infiniband/hw/mlx5/fs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/fs.c +4 -1
index 691d00c89f33..617e0e9c0c8e 100644
@@ -2079,9 +2079,12 @@ static int mlx5_ib_matcher_ns(struct uverbs_attr_bundle *attrs,
 			return err;
 
 		if (flags) {
-			mlx5_ib_ft_type_to_namespace(
+			err = mlx5_ib_ft_type_to_namespace(
 				MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX,
 				&obj->ns_type);
+			if (err)
+				return err;
+
 			return 0;
 		}
 	}
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines · Sebin Sebastian

Unchecked return value warning as reported by Coverity static analyzer tool. check the return value of mlx5_ib_ft_type_to_namespace().

---
 drivers/infiniband/hw/mlx5/fs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Thanks, I had similar patch in my internal queue.
https://lore.kernel.org/linux-rdma/7b9ceda217d9368a51dc47a46b769bad4af9ac92.1659256069.git.leonro@nvidia.com/T/#u

Quoted 22 lines
drivers/infiniband/hw/mlx5/fs.c +4 -1
index 691d00c89f33..617e0e9c0c8e 100644
@@ -2079,9 +2079,12 @@ static int mlx5_ib_matcher_ns(struct uverbs_attr_bundle *attrs,
 			return err;
 
 		if (flags) {
-			mlx5_ib_ft_type_to_namespace(
+			err = mlx5_ib_ft_type_to_namespace(
 				MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX,
 				&obj->ns_type);
+			if (err)
+				return err;
+
 			return 0;
 		}
 	}
Signature · 1 line
2.34.1
maintainer
#2 lore raw
In reply to Sebin Sebastian
Quoted 7 lines · Sebin Sebastian

Unchecked return value warning as reported by Coverity static analyzer tool. check the return value of mlx5_ib_ft_type_to_namespace().

---
 drivers/infiniband/hw/mlx5/fs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Leon's is cleaner and has a proper fixes line, so I will use his

Thanks,
Jason