net/netvsc: fix bogus sizeof calculation
PATCH 1/1 net/netvsc: fix bogus sizeof calculation
From: Stephen Hemminger <[email protected]>
Found by cppcheck.
drivers/net/netvsc/hn_rndis.c:332:21: warning: Found calculation inside sizeof(). [sizeofCalculation] if (len < sizeof(3 * sizeof(uint32_t))) {
Fixes 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Signed-off-by Stephen Hemminger <[email protected]>
Signed-off-by Long Li <[email protected]>
--- drivers/net/netvsc/hn_rndis.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/netvsc/hn_rndis.c +2 -1
@@ -329,7 +329,8 @@ void hn_rndis_receive_response(struct hn_data *hv,hn_rndis_dump (data); -if (len <sizeof (3 *sizeof (uint32_t ))) { +/* Check we can read first three data fields from RNDIS header */ +if (len <3 *sizeof (uint32_t )) {PMD_DRV_LOG (ERR ,"missing RNDIS header %u" , len);return ;
Signature · 1 line
2.17.1
Ferruh Yigit
AppliedQuoted 10 lines · On 6/29/2023 1:29 AM, [email protected] wrote:
From: Stephen Hemminger <[email protected]>
Found by cppcheck.
drivers/net/netvsc/hn_rndis.c:332:21: warning: Found calculation insidesizeof(). [sizeofCalculation] if (len <sizeof(3 * sizeof(uint32_t))) {Fixes 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")Signed-off-by Stephen Hemminger <[email protected]>Signed-off-by Long Li <[email protected]>
Applied to dpdk-next-net/main, thanks.
Quoted 10 lines · On Wed, Jun 28, 2023 at 05:29:57PM -0700, [email protected] wrote:
From: Stephen Hemminger <[email protected]>
Found by cppcheck.
drivers/net/netvsc/hn_rndis.c:332:21: warning: Found calculation insidesizeof(). [sizeofCalculation] if (len <sizeof(3 * sizeof(uint32_t))) {Fixes 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")Signed-off-by Stephen Hemminger <[email protected]>Signed-off-by Long Li <[email protected]>---
Acked-by Tyler Retzlaff <[email protected]>