lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] Three potential syntax errors in DHCP.c


From: address@hidden
Subject: Re: [lwip-devel] Three potential syntax errors in DHCP.c
Date: Mon, 24 Nov 2008 18:32:05 +0100
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)

I don't really get the problem here: options should be pointing to the first byte of dhcp->msg_in->file (since file is a byte array of 128). This is used to later index the byte array: options[offset]. Why is there a warning about that?

Simon


Rejean Groleau wrote:
I was "linting" the LwIP source code the other day, and I found three trivial
warnings that might cause problems. Most likely the related lines of codes
are in fact error-free, and I misunderstood what they were actually doing,
but still I thought I should share the information on this mailing list.

1. In the file DHCP.c:
 a. Line 1472:
   - Before: options = (u8_t *)&dhcp->msg_in->file
   - After: options = (u8_t *)dhcp->msg_in->file
   - Explanation: the line was doing "pointer = address of pointer",
     instead of doing "pointer = pointer".
 b. Lines 1476 and 1481:
   - Before: options = (u8_t *)&dhcp->msg_in->sname
   - After: options = (u8_t *)dhcp->msg_in->sname
   - Explanation: (same as line 1472).

And that's all I found. I added a few assertion macros on tcp_pcb pointers
to validate my own calls, but nothing really worth mentioning. The stack is
very well coded in my opinion.

- Rejean Groleau





reply via email to

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