buglwIP - A Lightweight TCP/IP stack - Bugs: bug #46595, Useless Assert

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #46595: Useless Assert

Submitted by:  April M <april_m>
Submitted on:  Thu 03 Dec 2015 07:26:56 AM UTC  
 
Category: Network driversSeverity: 3 - Normal
Item Group: Change RequestStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned Release: None
lwIP version: git head

Sat 05 Dec 2015 08:15:27 PM UTC, comment #4:

This is a valid underflow (wraparound) check

Dirk Ziegelmeier <dziegel>
Project Member
Thu 03 Dec 2015 07:34:54 AM UTC, comment #3:

Refer to the context, maybe below is better:

LWIP_ASSERT("netif->loop_cnt_current underflow",
netif->loop_cnt_current >= clen);

April M <april_m>
Thu 03 Dec 2015 07:32:09 AM UTC, comment #2:

Maybe it could be modified to

LWIP_ASSERT("netif->loop_cnt_current underflow",
!clen);

PS: clen has been initialized to be 1 ahead.

April M <april_m>
Thu 03 Dec 2015 07:27:30 AM UTC, comment #1:

equals to 0 < clen

April M <april_m>
Thu 03 Dec 2015 07:26:56 AM UTC, original submission:

Netif.c Line 834~835 netif_poll

LWIP_ASSERT("netif->loop_cnt_current underflow",
((netif->loop_cnt_current - clen) < (netif->loop_cnt_current));

(netif->loop_cnt_current - clen) < (netif->loop_cnt_current
equals to

  1. < clen

Since clen is u8_t, it will always to be true.

Why need Assert like this?

April M <april_m>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dziegel (Posted a comment)
  • -unavailable- added by april_m (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 05 Dec 2015 08:15:27 PM UTCdziegelStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1