From patchwork Sat Nov 7 21:04:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Jenkins X-Patchwork-Id: 58381 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 nA7L6Fta019420 for ; Sat, 7 Nov 2009 21:06:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752920AbZKGVEx (ORCPT ); Sat, 7 Nov 2009 16:04:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753248AbZKGVEx (ORCPT ); Sat, 7 Nov 2009 16:04:53 -0500 Received: from mxout-08.mxes.net ([216.86.168.183]:39964 "EHLO mxout-08.mxes.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752920AbZKGVEY (ORCPT ); Sat, 7 Nov 2009 16:04:24 -0500 Received: from localhost.localdomain (unknown [86.53.68.233]) by smtp.mxes.net (Postfix) with ESMTPA id 5F969509E0; Sat, 7 Nov 2009 16:04:29 -0500 (EST) From: Alan Jenkins To: rusty@rustcorp.com.au Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Alan Jenkins Subject: [PATCH 10/10] module: fix is_exported() to return true for all types of exports Date: Sat, 7 Nov 2009 21:04:01 +0000 Message-Id: <1257627841-15817-10-git-send-email-alan-jenkins@tuffmail.co.uk> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <4AF5DF9F.5020208@tuffmail.co.uk> References: <4AF5DF9F.5020208@tuffmail.co.uk> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org diff --git a/kernel/module.c b/kernel/module.c index 56a7e65..021b9cc 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1830,33 +1830,19 @@ static void free_modinfo(struct module *mod) #ifdef CONFIG_KALLSYMS -/* lookup symbol in given range of kernel_symbols */ -static const struct kernel_symbol *lookup_symbol(const char *name, - const struct kernel_symbol *syms, - unsigned int count) -{ - unsigned int i; - - for (i = 0; i < count; i++) - if (strcmp(syms[i].name, name) == 0) - return &syms[i]; - return NULL; -} - static int is_exported(const char *name, unsigned long value, - const struct module *mod) + struct module *mod) { - const struct ksymtab *symtab; - const struct kernel_symbol *ks; + const struct kernel_symbol *sym; + enum export_type type; + const unsigned long *crc; - if (!mod) - symtab = &ksymtab[EXPORT_TYPE_PLAIN]; + if (mod) + sym = find_symbol_in_module(mod, name, &type, &crc); else - symtab = &mod->syms[EXPORT_TYPE_PLAIN]; - - ks = lookup_symbol(name, symtab->syms, symtab->num_syms); + sym = find_symbol_in_kernel(name, &type, &crc); - return ks != NULL && ks->value == value; + return (sym && sym->value == value); } /* As per nm */