Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2837855pxa; Mon, 17 Aug 2020 22:11:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhQWK9fMFH3xxsIczNbRMRpOJBshg1bwp0nZJvhzudeRnnVifjg1kziRSN6wjFjhBb3LvU X-Received: by 2002:a17:906:d209:: with SMTP id w9mr17956637ejz.93.1597727500231; Mon, 17 Aug 2020 22:11:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597727500; cv=none; d=google.com; s=arc-20160816; b=ZcoWNl00cYtStEPR0Ph02Cku9fKaUoU1st0lM9dey5lkrKkU3ZVZS12ozgrMFij+Ds LJVGzDL2F8HeD9e1vmZC8EmVNuXZGu9S0TLt9wgKDHf9OUQdfeAZlwhjSzHKCtGAeCoQ Tifj7zj807nGk+Vx15DvViKPQiaUVsx7kGyJPNqL+57dyThViXRhsNzsylx6i9bgOLiK Sl+PR+KI3PcYDKtqrzAXmj6JcQZ42F/cDz5nLeAd6BLVtpHRhMU1Ws7OEZhsFwxF24wO Sxh1YSG5oMYEFirwemtTE/79JLT44kNeJmQThFnriDRiCjZfp/g2ln8cUvHWgVOTMIHs DgOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=xojulDfvcEvRG6zfPP6qX+EANNOtu1xHEQWSs4LfDqU=; b=d1Syk7Bzp6foeNBxR84ZT96geUbSvdkbkWoOfjgfUEeEpd6qbVfeKRqSN3WYlUeX8M scxpovst3f9Phm3ZQ4Ag8e6BXWcBPEvb4IBM1y5lS6h8qYnWkBF2fnQ1vhshisNBDzY6 GrMTLa4ooiEaP2+pqhnHEyFE884/fNvLEWThsdO3XclwE7+nV/58IwKTabdtQcOrS7fc pPwBvFTQ81OhqnnKQ0nBq13QXDP3KCLNH98jy8HtGJDpSvFwvLFvK+Wc5h8YEZ997jJE MdfiHIkeeTwloQc+D9H8EvJHqqjk8drfC/77lWOpcZ/quYPF4d/tt5NpiE36GGdMXtwn aa9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q21si12692062edg.71.2020.08.17.22.11.16; Mon, 17 Aug 2020 22:11:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726560AbgHRFJL (ORCPT + 99 others); Tue, 18 Aug 2020 01:09:11 -0400 Received: from mga01.intel.com ([192.55.52.88]:3654 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726302AbgHRFJJ (ORCPT ); Tue, 18 Aug 2020 01:09:09 -0400 IronPort-SDR: FTqrzF8TunJyv02OCkuRuBAjvhtklurs+5LzCO9BdvjhiLJUuIfQJVl/oZrW2U0w8VWIDw9AT0 K+TT+dIw9iPg== X-IronPort-AV: E=McAfee;i="6000,8403,9716"; a="172891204" X-IronPort-AV: E=Sophos;i="5.76,326,1592895600"; d="scan'208";a="172891204" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2020 22:09:09 -0700 IronPort-SDR: ziaGWUr8V2D2f+nbYi83m8NhaLhf+LOFOtV1ZlsiIHVxSSqIOiBLxguavrTz/eGQ3Oc8FxO1Hh yBXL5N74MYFg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,326,1592895600"; d="scan'208";a="292652501" Received: from lcrossx-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.46.217]) by orsmga003.jf.intel.com with ESMTP; 17 Aug 2020 22:09:05 -0700 From: Jarkko Sakkinen To: linux-kernel@vger.kernel.org Cc: Jarkko Sakkinen , linux-mm@kvack.org, Andi Kleen , Ard Biesheuvel , Jessica Yu , Mark Rutland , Masami Hiramatsu , Mike Rapoport , Peter Zijlstra , Russell King , Will Deacon , Steven Rostedt , Ingo Molnar Subject: [PATCH] kprobes: Use module_name() macro Date: Tue, 18 Aug 2020 08:08:57 +0300 Message-Id: <20200818050857.117998-1-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is advised to use module_name() macro instead of dereferencing mod->name directly. This makes sense for consistencys sake and also it prevents a hard dependency to CONFIG_MODULES. Cc: linux-mm@kvack.org Cc: Andi Kleen Cc: Ard Biesheuvel Cc: Jessica Yu Cc: Mark Rutland , Cc: Masami Hiramatsu Cc: Mike Rapoport Cc: Peter Zijlstra Cc: Russell King Cc: Will Deacon Signed-off-by: Jarkko Sakkinen --- I thought that to get things moving it would make sense to fix this low hanging fruit issue first. Similarly as Masami's fix kernel/kprobes.c this will make my patch set less rambling, and thus easier to follow. kernel/trace/trace_kprobe.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index aefb6065b508..19c00ee90945 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -106,9 +106,10 @@ static nokprobe_inline bool trace_kprobe_has_gone(struct trace_kprobe *tk) static nokprobe_inline bool trace_kprobe_within_module(struct trace_kprobe *tk, struct module *mod) { - int len = strlen(mod->name); + int len = strlen(module_name(mod)); const char *name = trace_kprobe_symbol(tk); - return strncmp(mod->name, name, len) == 0 && name[len] == ':'; + + return strncmp(module_name(mod), name, len) == 0 && name[len] == ':'; } static nokprobe_inline bool trace_kprobe_module_exist(struct trace_kprobe *tk) @@ -688,7 +689,7 @@ static int trace_kprobe_module_callback(struct notifier_block *nb, if (ret) pr_warn("Failed to re-register probe %s on %s: %d\n", trace_probe_name(&tk->tp), - mod->name, ret); + module_name(mod), ret); } } mutex_unlock(&event_mutex); -- 2.25.1