Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753503AbbHGFgM (ORCPT ); Fri, 7 Aug 2015 01:36:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:58425 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752114AbbHGFgL (ORCPT ); Fri, 7 Aug 2015 01:36:11 -0400 Date: Fri, 07 Aug 2015 07:36:09 +0200 Message-ID: From: Takashi Iwai To: Rusty Russell Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] modpost: abort if a module symbol is too long In-Reply-To: <871tfgcefb.fsf@rustcorp.com.au> References: <1438876428-19911-1-git-send-email-tiwai@suse.de> <871tfgcefb.fsf@rustcorp.com.au> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1855 Lines: 52 On Thu, 06 Aug 2015 23:09:12 +0200, Rusty Russell wrote: > > Takashi Iwai writes: > > Module symbols have a limited length, but currently the build system > > allows the build finishing even if the driver code contains a too long > > symbol name, which eventually overflows the modversion_info[] item. > > The compiler may catch at compiling *.mod.c like > > CC xxx.mod.o > > xxx.mod.c:18:16: warning: initializer-string for array of chars is too long > > but it's merely a warning. > > > > This patch adds the check of the symbol length in modpost and stops > > the build properly. > > > > As of now, MODULE_NAME_LEN is copied in modpost.c. At best, this > > should be read directly from kernel headers. But including > > linux/module.h is too troublesome for now, so just paper over it. > > > > Signed-off-by: Takashi Iwai > > --- > > scripts/mod/modpost.c | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > > index 12d3db3bd46b..25bda9d2868c 100644 > > --- a/scripts/mod/modpost.c > > +++ b/scripts/mod/modpost.c > > @@ -2133,6 +2133,9 @@ static void add_staging_flag(struct buffer *b, const char *name) > > buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n"); > > } > > > > +/* FIXME: better to be included from kernel header */ > > +#define MODULE_NAME_LEN (64 - sizeof(unsigned long)) > > This isn't quite right, since modpost handles cross-compilation. > > #define MODULE_NAME_LEN (64 - sizeof(Elf_Addr)) > > Should work... Alright, I'll resubmit with this fix. Thanks! Takashi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/