lwip-devel
[Top][All Lists]
Advanced

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

RE: [lwip-devel] Possibly falsely triggered LWIP_ASSERT?


From: Bill Auerbach
Subject: RE: [lwip-devel] Possibly falsely triggered LWIP_ASSERT?
Date: Tue, 29 Sep 2009 11:02:31 -0400

>Looking at pbuf_realloc() there is one thing there that worries me:
>Line 342:
>    q->tot_len += (u16_t)grow;
>
>We're casting grow (which is negative in the shrinking case) to a u16_t.
>I think this should be case to a s16_t to preserve the sign of grow, and
>correctly handle increasing and decreasing the size.  Does anyone
>disagree - if I'm missing something I'd like to know.  This could
>explain the problem you're seeing if pbuf_realloc() had been called
>earlier on.  It's certainly worth trying with that change.

Because tot_len and grow (via casting) are u16_t, there is no problem here -
no sign extension can occur.  If tot_len were larger, this would be a bug.
In order to be "righter" this should be a cast to s_16t.  The compiler
output will be unchanged by this change.

Bill






reply via email to

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