From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 4 18:27:18 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CB30106566B; Wed, 4 Feb 2009 18:27:18 +0000 (UTC) (envelope-from csjp@freebsd.org) Received: from mx-02mtaout01.mts.net (mx-02mtaout01.mts.net [142.161.131.3]) by mx1.freebsd.org (Postfix) with ESMTP id DA6D78FC12; Wed, 4 Feb 2009 18:27:17 +0000 (UTC) (envelope-from csjp@freebsd.org) Received: from wnpgmb021pw-sp03.mts.net ([10.204.128.23]) by mx-02mtaout01.mts.net with ESMTP id <20090204182716.PAJP3921.mx-02mtaout01.mts.net@wnpgmb021pw-sp03.mts.net>; Wed, 4 Feb 2009 12:27:16 -0600 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsIEAA5tiUmOoTqg/2dsb2JhbACBbs8ChBYG X-IronPort-AV: E=Sophos;i="4.37,380,1231135200"; d="scan'208";a="60243035" Received: from wnpgmb1309w-ad05-58-160.dynamic.mts.net (HELO jnz.my.domain) ([142.161.58.160]) by wnpgmb021pw-sp03.mts.net with ESMTP; 04 Feb 2009 12:27:16 -0600 Received: from jnz.my.domain (localhost [127.0.0.1]) by jnz.my.domain (8.14.3/8.14.2) with ESMTP id n14IRFax076044; Wed, 4 Feb 2009 12:27:15 -0600 (CST) (envelope-from csjp@jnz.my.domain) Received: (from csjp@localhost) by jnz.my.domain (8.14.3/8.14.2/Submit) id n14IRFic076043; Wed, 4 Feb 2009 12:27:15 -0600 (CST) (envelope-from csjp) Date: Wed, 4 Feb 2009 12:27:15 -0600 From: Christian Peron To: Christoph Mallon Message-ID: <20090204182715.GA75911@jnz.sqrt.ca> References: <49874CA8.5090605@gmx.de> <20090203231155.GA69101@jnz.sqrt.ca> <4989AC31.6000904@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4989AC31.6000904@gmx.de> User-Agent: Mutt/1.4.2.3i Cc: FreeBSD Hackers , FreeBSD Current , Christian Peron Subject: Re: write-only variables in src/sys/ - possible bugs X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Feb 2009 18:27:18 -0000 On Wed, Feb 04, 2009 at 03:54:41PM +0100, Christoph Mallon wrote: [..] > > Yes, function arguments are considered being read. The problem is > different here: mtod() should be a macro, but the macro declaration was > missing (*cough* hacked build process *cough*). So the parser tried to > parse this as function call. Then it hit the "void *", which confused it > - it got a type while parsing an expression. I improved the error > correction, resolved a few other problems, too, and generated a new list: > > http://tron.homeunix.org/unread_variables.log > (The list has a date at the top, if it is missing, you see the old list > in your browser cache) > > The false positives, which you mentioned, are gone now - thanks for > reporting this. The list now contains about 1.000 entries and about 60 > concern variables named 'error'. Also.. one other thing I noticed: void bpf_buffer_append_mbuf(struct bpf_d *d, caddr_t buf, u_int offset, void *src, u_int len) { const struct mbuf *m; u_char *dst; u_int count; m = (struct mbuf *)src; dst = (u_char *)buf + offset; while (len > 0) { if (m == NULL) panic("bpf_mcopy"); count = min(m->m_len, len); bcopy(mtod(m, void *), dst, count); m = m->m_next; dst += count; len -= count; } } dst += count In this expression, both dst and count are read since this is the same thing as: dst = dst + count;