Skip to contentSkip to conversation

net: Initialize all members in skb_gro_remcsum_init()

PATCH Applied Geert Uytterhoeven 3 participants 3 messages Feb 18, 2015 – Feb 20, 2015

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

PATCH 1/1 net: Initialize all members in skb_gro_remcsum_init()

skb_gro_remcsum_init() initializes the gro_remcsum.delta member only, leading to compiler warnings about a possibly uninitialized gro_remcsum.offset member:

drivers/net/vxlan.c: In function ‘vxlan_gro_receive’:
drivers/net/vxlan.c:602: warning: ‘grc.offset’ may be used uninitialized in this function net/ipv4/fou.c: In function ‘gue_gro_receive’:
net/ipv4/fou.c:262: warning: ‘grc.offset’ may be used uninitialized in this function

While these are harmless for now:
- skb_gro_remcsum_process() sets offset before changing delta,
- skb_gro_remcsum_cleanup() checks if delta is non-zero before accessing offset,
it's safer to let the initialization function initialize all members.

---
 include/linux/netdevice.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/netdevice.h +1 -0
index 5897b4ea5a3f9e0f..429d1790a27e85f3 100644
@@ -2342,6 +2342,7 @@ struct gro_remcsum {
 
 static inline void skb_gro_remcsum_init(struct gro_remcsum *grc)
 {
+	grc->offset = 0;
 	grc->delta = 0;
 }
 
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Geert Uytterhoeven

skb_gro_remcsum_init() initializes the gro_remcsum.delta member only, leading to compiler warnings about a possibly uninitialized gro_remcsum.offset member:

drivers/net/vxlan.c: In function ‘vxlan_gro_receive’:
drivers/net/vxlan.c:602: warning: ‘grc.offset’ may be used uninitialized in this function net/ipv4/fou.c: In function ‘gue_gro_receive’:
net/ipv4/fou.c:262: warning: ‘grc.offset’ may be used uninitialized in this function

Quoted 6 lines

While these are harmless for now:
- skb_gro_remcsum_process() sets offset before changing delta,
- skb_gro_remcsum_cleanup() checks if delta is non-zero before accessing offset,
it's safer to let the initialization function initialize all members.

Quoted 20 lines
---
 include/linux/netdevice.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/netdevice.h +1 -1
index 5897b4ea5a3f9e0f..429d1790a27e85f3 100644
@@ -2342,6 +2342,7 @@ struct gro_remcsum {
 
 static inline void skb_gro_remcsum_init(struct gro_remcsum *grc)
 {
+       grc->offset = 0;
        grc->delta = 0;
 }
 
--

1.9.1

maintainer Applied
#2 lore raw
In reply to Geert Uytterhoeven

From: Geert Uytterhoeven <[email protected]>
Date: Wed, 18 Feb 2015 11:38:06 +0100

Quoted 9 lines

skb_gro_remcsum_init() initializes the gro_remcsum.delta member only, leading to compiler warnings about a possibly uninitialized gro_remcsum.offset member:

drivers/net/vxlan.c: In function ‘vxlan_gro_receive’:
drivers/net/vxlan.c:602: warning: ‘grc.offset’ may be used uninitialized in this function net/ipv4/fou.c: In function ‘gue_gro_receive’:
net/ipv4/fou.c:262: warning: ‘grc.offset’ may be used uninitialized in this function

Quoted 7 lines

While these are harmless for now:
- skb_gro_remcsum_process() sets offset before changing delta,
- skb_gro_remcsum_cleanup() checks if delta is non-zero before accessing offset,
it's safer to let the initialization function initialize all members.

Applied, thank you.