From owner-freebsd-hackers Thu Mar 23 11:45:30 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from ns.yogotech.com (ns.yogotech.com [206.127.79.126]) by hub.freebsd.org (Postfix) with ESMTP id C81F437BDC3 for ; Thu, 23 Mar 2000 11:45:18 -0800 (PST) (envelope-from nate@yogotech.com) Received: from nomad.yogotech.com (nomad.yogotech.com [206.127.79.115]) by ns.yogotech.com (8.9.3/8.9.3) with ESMTP id MAA22680; Thu, 23 Mar 2000 12:45:07 -0700 (MST) (envelope-from nate@nomad.yogotech.com) Received: (from nate@localhost) by nomad.yogotech.com (8.8.8/8.8.8) id MAA04154; Thu, 23 Mar 2000 12:45:07 -0700 (MST) (envelope-from nate) Date: Thu, 23 Mar 2000 12:45:07 -0700 (MST) Message-Id: <200003231945.MAA04154@nomad.yogotech.com> From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: nate@yogotech.com (Nate Williams) Cc: Matthew Dillon , Jim Mercer , hackers@FreeBSD.ORG Subject: Re: Doh, compiler bug... (was Re: possible bug in kernel/if_ether.c) 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> X-Mailer: VM 6.34 under 19.16 "Lille" XEmacs Lucid Reply-To: nate@yogotech.com (Nate Williams) Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > 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