Skip to content

Commit 576fb67

Browse files
ecsvsimonwunderlich
authored andcommitted
batman-adv: Avoid sizeof on flexible structure
The batadv_dhcp_packet is used to read in parts of the DHCP packet and extract relevant information for the distributed arp table. But the structure contained the flexible member "options" which is no where used in the code. A sizeof on this kind of type would return the size of everything except the flexible member. But sparse will detect this kind of sizeof and warn with warning: using sizeof on a flexible structure This can be avoided by dropping the unused flexible member. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
1 parent cfa55c6 commit 576fb67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/batman-adv/distributed-arp-table.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct batadv_dhcp_packet {
8787
__u8 sname[64];
8888
__u8 file[128];
8989
__be32 magic;
90-
__u8 options[];
90+
/* __u8 options[]; */
9191
};
9292

9393
#define BATADV_DHCP_YIADDR_LEN sizeof(((struct batadv_dhcp_packet *)0)->yiaddr)

0 commit comments

Comments
 (0)