* [PATCH] net/netvsc: fix bogus sizeof calculation
@ 2023-06-29 0:29 longli
2023-06-29 11:13 ` Ferruh Yigit
2023-06-29 15:51 ` Tyler Retzlaff
0 siblings, 2 replies; 3+ messages in thread
From: longli @ 2023-06-29 0:29 UTC (permalink / raw)
To: Ferruh Yigit, Andrew Rybchenko
Cc: dev, stable.dpdk.org, Stephen Hemminger, Long Li
From: Stephen Hemminger <stephen@networkplumber.org>
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 <stephen@networkplumber.org>
Signed-off-by: Long Li <longli@microsoft.com>
---
drivers/net/netvsc/hn_rndis.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index e6f1f28768..29c6009b2c 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -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;
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/netvsc: fix bogus sizeof calculation
2023-06-29 0:29 [PATCH] net/netvsc: fix bogus sizeof calculation longli
@ 2023-06-29 11:13 ` Ferruh Yigit
2023-06-29 15:51 ` Tyler Retzlaff
1 sibling, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2023-06-29 11:13 UTC (permalink / raw)
To: longli, Andrew Rybchenko; +Cc: dev, stable.dpdk.org, Stephen Hemminger
On 6/29/2023 1:29 AM, longli@linuxonhyperv.com wrote:
> From: Stephen Hemminger <stephen@networkplumber.org>
>
> 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 <stephen@networkplumber.org>
> Signed-off-by: Long Li <longli@microsoft.com>
>
Applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/netvsc: fix bogus sizeof calculation
2023-06-29 0:29 [PATCH] net/netvsc: fix bogus sizeof calculation longli
2023-06-29 11:13 ` Ferruh Yigit
@ 2023-06-29 15:51 ` Tyler Retzlaff
1 sibling, 0 replies; 3+ messages in thread
From: Tyler Retzlaff @ 2023-06-29 15:51 UTC (permalink / raw)
To: longli
Cc: Ferruh Yigit, Andrew Rybchenko, dev, stable.dpdk.org, Stephen Hemminger
On Wed, Jun 28, 2023 at 05:29:57PM -0700, longli@linuxonhyperv.com wrote:
> From: Stephen Hemminger <stephen@networkplumber.org>
>
> 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 <stephen@networkplumber.org>
> Signed-off-by: Long Li <longli@microsoft.com>
> ---
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-29 15:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 0:29 [PATCH] net/netvsc: fix bogus sizeof calculation longli
2023-06-29 11:13 ` Ferruh Yigit
2023-06-29 15:51 ` Tyler Retzlaff
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).