Skip to content

Commit 20314ba

Browse files
groeckgregkh
authored andcommitted
staging: r8188eu: Fix PPPoE tag insertion on little endian systems
In __nat25_add_pppoe_tag(), the tag length is read from the tag data structure. The value is kept in network format, but read as raw value. With -Warray-bounds, this results in the following gcc error/warning when building the driver on alpha. In function '__nat25_add_pppoe_tag', inlined from 'nat25_db_handle' at drivers/staging/r8188eu/core/rtw_br_ext.c:479:11: arch/alpha/include/asm/string.h:22:16: error: '__builtin_memcpy' forming offset [40, 2051] is out of the bounds [0, 40] of object 'tag_buf' with type 'unsigned char[40]' Add the missing be16_to_cpu() to fix the compile error. It should be noted, however, that this fix means that the code did probably not work on any little endian systems and/or that the driver has other endiannes related issues. A build with C=1 suggests that this is indeed the case. This patch does not attempt to fix any of those other issues. Fixes: 1586512 ("staging: r8188eu: introduce new core dir for RTL8188eu driver") Cc: Phillip Potter <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3123109 commit 20314ba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/staging/r8188eu/core/rtw_br_ext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *tag)
7070
struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN);
7171
int data_len;
7272

73-
data_len = tag->tag_len + TAG_HDR_LEN;
73+
data_len = be16_to_cpu(tag->tag_len) + TAG_HDR_LEN;
7474
if (skb_tailroom(skb) < data_len)
7575
return -1;
7676

0 commit comments

Comments
 (0)