From patchwork Wed Dec 2 23:29:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 64377 X-Patchwork-Delegate: deller@gmx.de Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nB2NTNhN000934 for ; Wed, 2 Dec 2009 23:29:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754634AbZLBX3P (ORCPT ); Wed, 2 Dec 2009 18:29:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755504AbZLBX3P (ORCPT ); Wed, 2 Dec 2009 18:29:15 -0500 Received: from mail.gmx.net ([213.165.64.20]:36092 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754618AbZLBX3O (ORCPT ); Wed, 2 Dec 2009 18:29:14 -0500 Received: (qmail invoked by alias); 02 Dec 2009 23:29:19 -0000 Received: from p4FDB266B.dip0.t-ipconnect.de (EHLO p100.box) [79.219.38.107] by mail.gmx.net (mp037) with SMTP; 03 Dec 2009 00:29:19 +0100 X-Authenticated: #1045983 X-Provags-ID: V01U2FsdGVkX18ul5ZIursuW2+9FmyxtVpVOvCtphTqC7Ktc+ivZ8 J3sEH/lzk5FMnW Date: Thu, 3 Dec 2009 00:29:15 +0100 From: Helge Deller To: linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, kyle@mcmartin.ca, rusty@rustcorp.com.au, akpm@linux-foundation.org, James.Bottomley@HansenPartnership.com, roland@redhat.com, dave@hiauly1.hia.nrc.ca, torvalds@linux-foundation.org Subject: [PATCH] modules: don't export section names of empty sections via sysfs Message-ID: <20091202232915.GA2251@p100.box> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.46 Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org diff --git a/kernel/module.c b/kernel/module.c index 8b7d880..5842a71 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1187,7 +1187,8 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect, /* Count loaded sections and allocate structures */ for (i = 0; i < nsect; i++) - if (sechdrs[i].sh_flags & SHF_ALLOC) + if (sechdrs[i].sh_flags & SHF_ALLOC + && sechdrs[i].sh_size) nloaded++; size[0] = ALIGN(sizeof(*sect_attrs) + nloaded * sizeof(sect_attrs->attrs[0]), @@ -1207,6 +1208,8 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect, for (i = 0; i < nsect; i++) { if (! (sechdrs[i].sh_flags & SHF_ALLOC)) continue; + if (!sechdrs[i].sh_size) + continue; sattr->address = sechdrs[i].sh_addr; sattr->name = kstrdup(secstrings + sechdrs[i].sh_name, GFP_KERNEL);