From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755652AbZJZLRU (ORCPT ); Mon, 26 Oct 2009 07:17:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755624AbZJZLRT (ORCPT ); Mon, 26 Oct 2009 07:17:19 -0400 Received: from adelie.canonical.com ([91.189.90.139]:47278 "EHLO adelie.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755598AbZJZLRT (ORCPT ); Mon, 26 Oct 2009 07:17:19 -0400 Date: Mon, 26 Oct 2009 11:17:22 +0000 From: Andy Whitcroft To: Joe Perches Cc: Jan Ceuleers , David Miller , LKML Subject: Re: [PATCH] scripts/checkpatch.pl: Add WARN on sizeof(& Message-ID: <20091026111722.GF12089@shadowen.org> References: <20091002113038.1dc3d284@hyperion.delvare> <20091002.095402.42770342.davem@davemloft.net> <4AC77003.9090805@computer.org> <1254618769.1799.280.camel@Joe-Laptop.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1254618769.1799.280.camel@Joe-Laptop.home> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 03, 2009 at 06:12:49PM -0700, Joe Perches wrote: > On Sat, 2009-10-03 at 17:38 +0200, Jan Ceuleers wrote: > > David Miller wrote: > > > Any time you see "&" in a sizeof() expression, it's almost > > > certainly a bug. Something for the folks with automated > > > tools to look for if they haven't already :-) > > > > Your remark prompted me to find four more instances of such bugs > > (none of which in the networking bits). I have submitted patches. > > Perhaps a checkpatch test. > > --- > > sizeof(&foo) is frequently an error. Warn on its use. > > Signed-off-by: Joe Perches Seems reasonable. A slightly modified version of this is now in my tree. Thanks! http://www.kernel.org/pub/linux/kernel/people/apw/checkpatch/checkpatch.pl-testing -apw