Skip to contentSkip to conversation

i40e/virtchnl: fix application of sizeof to pointer

PATCH New Gustavo A. R. Silva 2 participants 2 messages Oct 18, 2017 – Nov 27, 2017

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

PATCH 1/1 i40e/virtchnl: fix application of sizeof to pointer

sizeof when applied to a pointer typed expression gives the size of the pointer.

The proper fix in this particular case is to code sizeof(*vfres) instead of sizeof(vfres).

This issue was detected with the help of Coccinelle.

---
This code was tested by compilation only.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -1
index f8a794b..56dd1e8 100644
@@ -2086,7 +2086,7 @@ static int i40e_vc_request_queues_msg(struct i40e_vf *vf, u8 *msg, int msglen)
 	}
 
 	return i40e_vc_send_msg_to_vf(vf, VIRTCHNL_OP_REQUEST_QUEUES, 0,
-				      (u8 *)vfres, sizeof(vfres));
+				      (u8 *)vfres, sizeof(*vfres));
 }
 
 /**
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 i40e/virtchnl: fix application of sizeof to pointer

Quoted 16 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Gustavo A. R. Silva
Sent: Wednesday, October 18, 2017 1:34 PM
To: Kirsher, Jeffrey T <[email protected]>
Cc: netdev at vger.kernel.org; intel-wired-lan at lists.osuosl.org; linux- kernel at vger.kernel.org; Gustavo A. R. Silva <[email protected]>
Subject: [Intel-wired-lan] [PATCH] i40e/virtchnl: fix application of sizeof to pointer

sizeof when applied to a pointer typed expression gives the size of the pointer.

The proper fix in this particular case is to code sizeof(*vfres) instead of sizeof(vfres).

Quoted 8 lines

This issue was detected with the help of Coccinelle.

---
This code was tested by compilation only.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)