Skip to content

Commit a20e962

Browse files
zaporozhetsjhedberg
authored andcommitted
net: if: Fix potential unaligned word access
The input address originates from an RX net_buf which may be unaligned. Consequently, word access to this unaligned buffer can trigger an unaligned access exception on certain platforms, such as the ARMv7 Cortex-A9. Signed-off-by: Taras Zaporozhets <[email protected]>
1 parent 938050c commit a20e962

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/net/ip/net_if.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3549,7 +3549,7 @@ static bool ipv4_is_broadcast_address(struct net_if *iface,
35493549
bcast.s_addr = ipv4->unicast[i].ipv4.address.in_addr.s_addr |
35503550
~ipv4->unicast[i].netmask.s_addr;
35513551

3552-
if (bcast.s_addr == addr->s_addr) {
3552+
if (bcast.s_addr == UNALIGNED_GET(&addr->s_addr)) {
35533553
ret = true;
35543554
goto out;
35553555
}

0 commit comments

Comments
 (0)