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: bill
Subject: RE: [lwip-devel] Three potential syntax errors in DHCP.c
Date: Mon, 24 Nov 2008 12:42:08 -0500

> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Kieran Mansley
> Sent: Monday, November 24, 2008 10:12 AM
> To: lwip-devel
> Subject: Re: [lwip-devel] Three potential syntax errors in DHCP.c
> 
> On Fri, 2008-11-21 at 10:04 -0800, 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.
> 
> Could you file a bug for this on savannah?

Taking the address of an array (sname is an array of u8) is still an address
- the same address as without the &.  If sname were a pointer, I agree with
this post, but the code would be broken as well.  I think that the more
reasonable warning from Link should be "Unnecessary address operator on
array type".

Bill






reply via email to

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