Date: Thu, 23 Mar 2000 12:45:07 -0700 (MST) From: Nate Williams <nate@yogotech.com> To: nate@yogotech.com (Nate Williams) Cc: Matthew Dillon <dillon@apollo.backplane.com>, Jim Mercer <jim@reptiles.org>, hackers@FreeBSD.ORG Subject: Re: Doh, compiler bug... (was Re: possible bug in kernel/if_ether.c) Message-ID: <200003231945.MAA04154@nomad.yogotech.com> In-Reply-To: <200003231942.MAA04132@nomad.yogotech.com> References: <20000322225639.T983@reptiles.org> <200003230515.VAA96507@apollo.backplane.com> <20000323054731.W983@reptiles.org> <200003231829.KAA02591@apollo.backplane.com> <200003231855.KAA02948@apollo.backplane.com> <200003231942.MAA04132@nomad.yogotech.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> > I found it. The code itself is broken. I missed the lack of parens. > > > > if (m->m_len < sizeof(struct arphdr) && > > (m = m_pullup(m, sizeof(struct arphdr)) == NULL)) { > > log(LOG_ERR, "arp: runt packet -- m_pullup failed."); > > continue; > > > > > > Should be: > > > > if (m->m_len < sizeof(struct arphdr) && > > ((m = m_pullup(m, sizeof(struct arphdr))) == NULL)) { > > log(LOG_ERR, "arp: runt packet -- m_pullup failed."); > > continue; > > Umm, I see what you've done, but doesn't == have greater precedence than > &&, so the code was fine as it was, wasn't it? Never mind, I missed the paren. However, I would have written the fix as follow so I wouldn't have missed the fix. :) if (m->m_len < sizeof(struct arphdr) && (m = m_pullup(m, sizeof(struct arphdr))) == NULL) { log(LOG_ERR, "arp: runt packet -- m_pullup failed."); continue; To each his own. :) Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003231945.MAA04154>