mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 20:05:54 +00:00
net: circumvent stringop-overflow error
With the update to GCC 10, the compiler stopped with an error when compiling places where a MAC address is copied from outside into a packed object using the Net::Netaddress::copy method (e.g. in Net::Arp_packet::dst_mac(Mac_address)): ! error: writing 6 bytes into a region of size 4 [-Werror=stringop-overflow=] While trying to find a clean solution for this error, I found posts on gcc.gnu.org and github that stated that the size calculations that cause these errors are incorrect. Indeed, I could verify that the actual size of the two regions was static and exactly the same in places were the error occured. Furthermore, I couldn't find a way of making it more clear to the compiler that the sizes are the same. By accident, we found that using the address of the first element of the array that forms the second region instead of the array address itself, somehow circumvents the error. Fixes #4109
This commit is contained in:
parent
52e8c95321
commit
49184fb938
@ -52,7 +52,7 @@ struct Net::Network_address
|
||||
** Helper methods **
|
||||
*********************/
|
||||
|
||||
void copy(void *dst) { Genode::memcpy(dst, addr, LEN); }
|
||||
void copy(void *dst) { Genode::memcpy(dst, &addr[0], LEN); }
|
||||
|
||||
void print(Genode::Output &output) const
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user