Skip to content

Commit 1f1c1d7

Browse files
ecsvdavem330
authored andcommitted
ipv6: Annotate bitwise IPv6 dsfield pointer cast
The sparse commit 6002ded74587 ("add a flag to warn on casts to/from bitwise pointers") introduced a check for non-direct casts from/to restricted datatypes (when -Wbitwise-pointer is enabled). This triggered a warning in ipv6_get_dsfield() because sparse doesn't know that the buffer already points to some data in the correct bitwise integer format. This was already fixed in ipv6_change_dsfield() by the __force attribute and can be fixed here the same way. Signed-off-by: Sven Eckelmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f325937 commit 1f1c1d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/net/dsfield.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static inline __u8 ipv4_get_dsfield(const struct iphdr *iph)
2121

2222
static inline __u8 ipv6_get_dsfield(const struct ipv6hdr *ipv6h)
2323
{
24-
return ntohs(*(const __be16 *)ipv6h) >> 4;
24+
return ntohs(*(__force const __be16 *)ipv6h) >> 4;
2525
}
2626

2727

0 commit comments

Comments
 (0)