From owner-freebsd-current@FreeBSD.ORG Wed Feb 4 14:54:44 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FD35106566B for ; Wed, 4 Feb 2009 14:54:44 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id A80E68FC16 for ; Wed, 4 Feb 2009 14:54:43 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 04 Feb 2009 14:54:41 -0000 Received: from p54A3EC72.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.236.114] by mail.gmx.net (mp023) with SMTP; 04 Feb 2009 15:54:41 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX1+7r78PhOK7U/405wvw/BA+R/Nu6BC8fJ0KktsM6s AaXLwSaYJDCd1+ Message-ID: <4989AC31.6000904@gmx.de> Date: Wed, 04 Feb 2009 15:54:41 +0100 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: Christian Peron References: <49874CA8.5090605@gmx.de> <20090203231155.GA69101@jnz.sqrt.ca> In-Reply-To: <20090203231155.GA69101@jnz.sqrt.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.6 Cc: FreeBSD Hackers , FreeBSD Current Subject: Re: write-only variables in src/sys/ - possible bugs X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Feb 2009 14:54:44 -0000 Christian Peron schrieb: > I started following up on this and ran into an issue for these: > > sys/net/bpf_buffer.c:133: warning: variable 'dst' is never read > sys/net/bpf_buffer.c:134: warning: variable 'count' is never read > sys/net/bpf_buffer.c:142: warning: variable 'dst' is never read > > > /* > * Scatter-gather data copy from an mbuf chain to the current kernel buffer. > */ > 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; > [..] > > Does it not consider being passed as an argument to a function as > being read? 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'.