Return-path: Received: from s3.sipsolutions.net ([144.76.43.152]:41916 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753554AbaAFJGA (ORCPT ); Mon, 6 Jan 2014 04:06:00 -0500 Message-ID: <1388999147.5891.2.camel@jlt4.sipsolutions.net> (sfid-20140106_100636_667862_5AF477A8) Subject: Re: [PATCH 4/11] use ether_addr_equal_64bits From: Johannes Berg To: Julia Lawall Cc: Ben Greear , Joe Perches , Henrique de Moraes Holschuh , kernel-janitors@vger.kernel.org, Emmanuel Grumbach , Intel Linux Wireless , "John W. Linville" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 06 Jan 2014 10:05:47 +0100 In-Reply-To: References: <1388427307-8691-1-git-send-email-Julia.Lawall@lip6.fr> <1388427307-8691-5-git-send-email-Julia.Lawall@lip6.fr> <1388429761.4410.1.camel@jlt4.sipsolutions.net> <1388438724.4573.2.camel@jlt4.sipsolutions.net> <20131230215701.GA4938@khazad-dum.debian.net> <1388445188.18164.0.camel@jlt4.sipsolutions.net> <1388445422.26796.38.camel@joe-AO722> <52C2E8BA.6000800@candelatech.com> <52C2F056.1020005@candelatech.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org List-ID: On Tue, 2013-12-31 at 17:40 +0100, Julia Lawall wrote: > > If nothing else, then some run-time code that calculates the offset off > > and asserts if it is broken in module initialization or similar might > > be good enough. > > Could be OK. Something right in or after the structure declaration would > be nicest. I don't think you can put a BUILD_BUG_ON() into the structure declaration (it's code, not declarations), but I think you could just put BUILD_BUG_ON(sizeof(struct foo) - offsetof(struct foo, addr) < 8); with the user(s?) and that should catch the scenario I was worrying about? johannes