[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Alignment problem i pbuf_alloc()
From: |
K.J. Mansley |
Subject: |
Re: [lwip-users] Alignment problem i pbuf_alloc() |
Date: |
24 May 2004 14:25:10 +0100 |
On Mon, 2004-05-24 at 07:41, Lars Thorup wrote:
> Hello,
>
> We are trying to get lwip to run on our Arm-7 board; however we are
> experiencing occasional memory overwrites, and we think that we have tracked
> the problem down to a bug in pbuf_alloc(). We use 4 byte alignment (so
> MEM_ALIGNMENT is 4).
>
> In pbuf_alloc() we find the following code fragment:
>
> > p = mem_malloc(MEM_ALIGN_SIZE(sizeof(struct pbuf) + length + offset));
> > ...
> > p->payload = MEM_ALIGN((void *)((u8_t *)p + sizeof(struct pbuf) +
> offset));
[snip]
> Are we correct in seeing this as bug?
Looks like it, but I'm not sure which bit is wrong. Out of interest,
where does the "6" bytes in the offset come from? I'm guessing some
physical layer header?
I can think of a number of work-arounds, but does anyone have a
suggestion for a solid fix?
Kieran