From patchwork Thu Jan 7 06:43:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng Renquan X-Patchwork-Id: 71548 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o076jZ1x020091 for ; Thu, 7 Jan 2010 06:46:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752522Ab0AGGpo (ORCPT ); Thu, 7 Jan 2010 01:45:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752822Ab0AGGpo (ORCPT ); Thu, 7 Jan 2010 01:45:44 -0500 Received: from mail-yx0-f188.google.com ([209.85.210.188]:39818 "EHLO mail-yx0-f188.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752522Ab0AGGpn (ORCPT ); Thu, 7 Jan 2010 01:45:43 -0500 Received: by yxe26 with SMTP id 26so17437143yxe.4 for ; Wed, 06 Jan 2010 22:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=bRPWptOdADsMqg50F1z/gD76WPH+60oHJVM+L3SmtFA=; b=RT192Ei74OTcD8wQ5J/PepACzsZ0f5H3o2TdNe32q7zo8TOFD2DPgPJiYGidd3whbJ YxkfouCQ55E5BwYU3R0Czxf+oAk++14Ze2HXjNCYqZgQSVrgi75xVrZpJe/K2TnaJEDn OI0nlOi+Lgi2Bg+16RgvMoOyQW+c2203IOsIY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=ngpYuDZSyUkDp6pOyt15Kuqp59DwIOexvLRgZRyXSVCcx5k5onh7ar65XvN6/FR65n VKRP21sOhqOGb2Ru0HclPApZ6Pe93sOlV5yJGgavDsTKsds6627OoyeDlS0oI+gcq7Ye 6Myhtnn3zPDzMenUGwcvYH6Kl/aksgmEhszCU= Received: by 10.101.188.15 with SMTP id q15mr2347522anp.156.1262846260164; Wed, 06 Jan 2010 22:37:40 -0800 (PST) Received: from localhost.localdomain ([202.161.43.231]) by mx.google.com with ESMTPS id 9sm7449230ywe.41.2010.01.06.22.37.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 06 Jan 2010 22:37:39 -0800 (PST) From: Cheng Renquan To: Michal Marek Cc: linux-kbuild@vger.kernel.org Subject: [PATCH] kallsyms: skip kernel symbols when lookup in module Date: Thu, 7 Jan 2010 14:43:46 +0800 Message-Id: <1262846626-27109-1-git-send-email-crquan@gmail.com> X-Mailer: git-send-email 1.6.5 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 8e5288a..bb9fdc5 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -173,12 +173,16 @@ unsigned long kallsyms_lookup_name(const char *name) unsigned long i; unsigned int off; - for (i = 0, off = 0; i < kallsyms_num_syms; i++) { - off = kallsyms_expand_symbol(off, namebuf); + /* if a colon ':' found, skip the heavy kernel symbols */ + if (strchr(name, ':') == NULL) { + for (i = 0, off = 0; i < kallsyms_num_syms; i++) { + off = kallsyms_expand_symbol(off, namebuf); - if (strcmp(namebuf, name) == 0) - return kallsyms_addresses[i]; + if (strcmp(namebuf, name) == 0) + return kallsyms_addresses[i]; + } } + return module_kallsyms_lookup_name(name); } EXPORT_SYMBOL_GPL(kallsyms_lookup_name);