Skip to content

Commit e361743

Browse files
keesdavem330
authored andcommitted
net: 802: Use memset_startat() to clear struct fields
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_startat() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting point of zeroing through the end of the struct. Signed-off-by: Kees Cook <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f5455a1 commit e361743

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/802/hippi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static int hippi_header(struct sk_buff *skb, struct net_device *dev,
6565
hip->le.src_addr_type = 2; /* 12 bit SC address */
6666

6767
memcpy(hip->le.src_switch_addr, dev->dev_addr + 3, 3);
68-
memset(&hip->le.reserved, 0, 16);
68+
memset_startat(&hip->le, 0, reserved);
6969

7070
hip->snap.dsap = HIPPI_EXTENDED_SAP;
7171
hip->snap.ssap = HIPPI_EXTENDED_SAP;

0 commit comments

Comments
 (0)