Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp891893pxp; Wed, 16 Mar 2022 20:22:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzyt3zBe3815KFPQ29k/7qtebwqovSuMNlKDN+zsoTqCvtnFwPMbefIIWYgyDAgL8ZB68b X-Received: by 2002:a62:7a88:0:b0:4f7:e60d:b181 with SMTP id v130-20020a627a88000000b004f7e60db181mr2943161pfc.9.1647487375244; Wed, 16 Mar 2022 20:22:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647487375; cv=none; d=google.com; s=arc-20160816; b=CX8BeFdij1JB8HeRc1V3ej5ecZ7ryhFAA9zC6d/D4eDy34syIou+sKHnb5kp3zAizf aVGoSCRGrqgdepMUbs+3WrRgs0kCP8Tk0/O1EvwhiMeiFKkpasjSgxFLTlHfN2A2T7rc B6yIeU7h9F4Fjgjg4tK4ibpkp2lJsQPeASOXLLCOA49EIZkR6sg+fl42zwvzDoLHfQD/ Gg5Recsk71FSp2OGdTLvftUkRzsnwwfkdybCEZorQy/cx11xNdzJTX34NzaOlAizsiBF RL0HsfJsPBDFd0D1p8Cprg39J4AO6ylJIhZHNPO7pQ/UWSNEmavw4Dnp22Ife0Tg9yQd gJuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WLWU+lYxj38a9L718ZJgMJpVrcc07UUvr0AxJS3XPTs=; b=Anjh7HI11yP+VYWsbl55CfpUyhpyAGHZra/pT35iI990s/xi1zfXILz9nx8v4X1mnx Jm21M6fza+f9Hjl4MkM5i4UrFeuFLAIRPyRQjwxyBNqu8vi47ddXqC5YXjeLyGeoU3fz ZDWPcMlJ1Zx0tUZt9KImbwx7ZAib2SU8z5XpXCrAhxfN7hYJyNvNLdRNAdKqxC4j4XCj exRmhYxGUVsOMFTjogJAjAQonOnbwUfBImyvwlZ35kLAoIHbo5+7tVyONXrAWbyuy4Mx C0LY/U6as/URwntL85hzycrznAW0quKDWkiIanIGLvLdSlECIeplFzPjlarJVT5zzGqa rtaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aOWBF80J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j3-20020a056a00234300b004f7a81760e5si4151190pfj.178.2022.03.16.20.22.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 20:22:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aOWBF80J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8246728E29; Wed, 16 Mar 2022 20:22:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355646AbiCPM0I (ORCPT + 99 others); Wed, 16 Mar 2022 08:26:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355659AbiCPM0G (ORCPT ); Wed, 16 Mar 2022 08:26:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A73DF4D9D1; Wed, 16 Mar 2022 05:24:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 35ACBB81AE4; Wed, 16 Mar 2022 12:24:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D55B6C340E9; Wed, 16 Mar 2022 12:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647433489; bh=5dSI2Vb07oF19cImCiHaEFsIdyzJFr+m3f7S16flnS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aOWBF80J2Jw1aJVgipMGQy2wkRkhslV1XC/JRAtHKHvpas1hSDUN/U3eLzG7qxLiX l9C+cmSQzokSiBAMaoAbNdCFJD5fw6m//qcCx10ovyLDwWNRZ0m/dGrcNnoidkYD0c n6hYqsbifn3b2rh2CAUX6ZcazCXGVrJqi+zd23xjG9I+xHaat/UNOiArvmQ39E14sH +abunun5WS10lecjwQBFGIM9Q7B7ii7aX3iTj5KiRvnyv3mpDnSHBxlpfJyq/uWU6o wCdZ/flnd1D4sYCK7PwIMP7hskdOTOqV/BUQaHJ+KqTCcLQFVMtTYjBx2qQ3ieGgBq dGJm+cx77hVVg== From: Jiri Olsa To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Masami Hiramatsu Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Steven Rostedt Subject: [PATCHv3 bpf-next 02/13] kallsyms: Skip the name search for empty string Date: Wed, 16 Mar 2022 13:24:08 +0100 Message-Id: <20220316122419.933957-3-jolsa@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220316122419.933957-1-jolsa@kernel.org> References: <20220316122419.933957-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When kallsyms_lookup_name is called with empty string, it will do futile search for it through all the symbols. Skipping the search for empty string. Signed-off-by: Jiri Olsa --- kernel/kallsyms.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 951c93216fc4..79f2eb617a62 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -212,6 +212,10 @@ unsigned long kallsyms_lookup_name(const char *name) unsigned long i; unsigned int off; + /* Skip the search for empty string. */ + if (!*name) + return 0; + for (i = 0, off = 0; i < kallsyms_num_syms; i++) { off = kallsyms_expand_symbol(off, namebuf, ARRAY_SIZE(namebuf)); -- 2.35.1