lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] Re: [bug #26273] etharp.c : fix alignment issue in etharp_r


From: Guillaume du Pontavice
Subject: [lwip-devel] Re: [bug #26273] etharp.c : fix alignment issue in etharp_raw
Date: Tue, 21 Apr 2009 20:15:00 +0200

well, in my case
hdr->sipaddr & hdr->dipaddr are two bytes aligned (not 4 bytes aligned), as the beginning of the payload is word aligned in my case & their offset in an ARP packet is only two bytes aligned.

on ST20, when trying to write on a non aligned address, there is no exception, but it may result in corruption of adjacent memory.

I guess the F*ING ST compiler did try to optimize the cast & generate a load word / store word instruction instead of two load short / store short instructions.
I will have a look at the assembly dump tomorrow to confirm this.



2009/4/21 Simon Goldschmidt <address@hidden>

Update of bug #26273 (project lwip):

                 Status:                    None => Need Info

   _______________________________________________________

Follow-up Comment #1:

I guess you have copied those lines from autoip.c:419 or etharp.c:667 ? In
these places, it is understandable to use memcpy, since we copy from a
2-byte-aligned struct to a 4-byte-aligned.

However, in your patch it is the other way round: a 4-byte-aligned struct is
casted to a 2-byte-aligned (which is in turn copied). How could that fail?

I don't have that strong an opinion against your patch, (since we already do
it that way in other places), only, I would like to understand why it fails
before changing it.

Someone know the answer?

   _______________________________________________________

Reply to this item at:

 <http://savannah.nongnu.org/bugs/?26273>

_______________________________________________
 Nachricht geschickt von/durch Savannah
 http://savannah.nongnu.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]