Skip to contentSkip to conversation

net: ethernet: marvell: octeontx2: nic: Add error pointer check in otx2_common.c

PATCH In review Dipendra Khadka 2 participants 2 messages Sep 23, 2024 – Sep 24, 2024

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

PATCH v2 1/1 net: ethernet: marvell: octeontx2: nic: Add error pointer check in otx2_common.c

Adding error pointer check after calling otx2_mbox_get_rsp().

Fixes ab58a416c93f ("octeontx2-pf: cn10k: Get max mtu supported from admin function")

---
v2:
- Added Fixes: tag.
- Changed the return logic to follow the existing return path.
v1: https://lore.kernel.org/all/[email protected]/

 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +4 -0
index 87d5776e3b88..e4bde38eebda 100644
@@ -1837,6 +1837,10 @@ u16 otx2_get_max_mtu(struct otx2_nic *pfvf)
 	if (!rc) {
 		rsp = (struct nix_hw_info *)
 		       otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr);
+		if (IS_ERR(rsp)) {
+			rc = PTR_ERR(rsp);
+			goto out;
+		}
 
 		/* HW counts VLAN insertion bytes (8 for double tag)
 		 * irrespective of whether SQE is requesting to insert VLAN
Signature · 1 line
2.43.0
reviewer
#1 lore raw

+ Maxime Chevallier

Quoted 11 lines · Dipendra Khadka

Adding error pointer check after calling otx2_mbox_get_rsp().

Fixes ab58a416c93f ("octeontx2-pf: cn10k: Get max mtu supported from admin function")

---
v2:
- Added Fixes: tag.
- Changed the return logic to follow the existing return path.
v1: https://lore.kernel.org/all/[email protected]/

 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 4 ++++
 1 file changed, 4 insertions(+)

Hi Dipendra,

Thanks for the updates,

I agree that this addresses Maxime's changes. I've CCed him here, please consider CCing people who comment on earlier revisions of patches.

My only nit about this patch is that, as per mo comment on [1], I think the prefix in the subject should be 'octeontx2-pf: '.

[1] https://lore.kernel.org/netdev/[email protected]/

Quoted 16 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +4 -0
index 87d5776e3b88..e4bde38eebda 100644
@@ -1837,6 +1837,10 @@ u16 otx2_get_max_mtu(struct otx2_nic *pfvf)
 	if (!rc) {
 		rsp = (struct nix_hw_info *)
 		       otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr);
+		if (IS_ERR(rsp)) {
+			rc = PTR_ERR(rsp);
+			goto out;
+		}
 
 		/* HW counts VLAN insertion bytes (8 for double tag)
 		 * irrespective of whether SQE is requesting to insert VLAN
Signature · 1 line
pw-bot: changes-requested