From patchwork Wed Dec 8 08:33:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12695297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54F0CC433EF for ; Wed, 8 Dec 2021 08:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5x1vgCwEA2e2boq6ZzYRJQPZaRfKDTYQEu6V1ffIlwc=; b=MSWBgGw1zHqJDT v34WaCoxN2R7FPb9ZrEY3BpQVBCDISOl3I2pQGik7ebMp+s+YkiRfYHOUrp6lXT8uNqSNBvzavsH3 +kLC7VZXv+hzdQ9QHtdefE6PiWHTbAG0ejuSy+XOf8RPGsQZdrg9awy7s0G6SGrhc+/4KQ2QtTN+u 3aLtz4sc5jkFpni5+E6IoKnyql2WZ6Drj6WANgymLet9kr5FhXQqQJWiegVzWPa3hsL+EODSHKZnt Wv4TF9cXuhItz3gmxQopiR5w1VUMwXOw6Qt7weu4RcZEAFkHOH2GGMq3b6CBnN5tRdTVb6ZGQ/iIs xVhgdDF9ur24vUc4tboA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1musOe-00Bi72-72; Wed, 08 Dec 2021 08:33:52 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1musOK-00Bhz9-ML for linux-arm-kernel@lists.infradead.org; Wed, 08 Dec 2021 08:33:34 +0000 Received: by mail-ed1-x529.google.com with SMTP id r11so5689266edd.9 for ; Wed, 08 Dec 2021 00:33:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nFpFNbcBX+lPeRGnonpR3BH6HPTPVDEm6tJ4QkqNbVo=; b=fyG2uCc9nPoybzx4IqY3kG3z4y/lzE2jNZjrff8vePl8GWtgZSaNMC65PLruzfzUFf dnAryvQpAWnYYa+ME9rtNg1BTldjtTWg8VMYpcbot++nJgPC/ZvNC6kvI9qPx5jokeor FLe6DmMQqJ6Xdfyq3TIhyZprBoXpZvj3lBY/aE6+D94wICjzXxClnejSEVcBq/MV9IzW HrGn3gPWi+N9sN8OZXa3LEvuAMppB3NSf2FAbkU2AzptV5XKKGctLZSdg2jCAIt+V7jH 6fHxN+eiDJ/z+RtnCyZ2TsqW3jbM4KHQCxYjmcLv5BGrsVHdBbRouve9mNV6lsfHWB21 WaGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nFpFNbcBX+lPeRGnonpR3BH6HPTPVDEm6tJ4QkqNbVo=; b=wh9Fo6RSPp7fmR4RaaqDIbJEEDKRtYXJgC/oTH6lfe6XREUGZUpbYDZzr8Z3kuzkqW l0XqTBIe3nNBchWE7+fV2LOiY2bex+nfEg83v9QnR4ofDQpp1pdBamnxGRCpi7v9z47+ PCDC04bj6ak2kAJ20gx6G0EC3LvuGKSr+YvzpUtexCFMvuvL9fW9QMhhMCTU+6lsqWdu gytO7SI5CzY3iscStJx9868L09niUHxlapp3ENA05S8+MOfRzW25ZQ9pqtHb2822rJen MQqAUlAytv8BH7GpgoJd9CIZXHBCZkTEUZd9W/XcSkqTbVkUoEoGJMmDaU+AyVcIITUA PSaw== X-Gm-Message-State: AOAM530xvnzcMCH+4E5kSzbR/5c2pjhI6IrmuB6HtQP3LGIcuzzqIp6J 2c6TubjhkjQB2e7RLlyGcxGtFw== X-Google-Smtp-Source: ABdhPJwjB4j2qwDPyk+4ObiPFmUCJJ3bfOq7wkfrgeKtjhkWvjp7+SQ4o/Bu5lKqkBurHaCAuz088g== X-Received: by 2002:a17:907:7e91:: with SMTP id qb17mr5835776ejc.449.1638952410925; Wed, 08 Dec 2021 00:33:30 -0800 (PST) Received: from localhost ([104.245.96.202]) by smtp.gmail.com with ESMTPSA id d10sm1089074eja.4.2021.12.08.00.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Dec 2021 00:33:30 -0800 (PST) From: Leo Yan To: "David S. Miller" , Jakub Kicinski , Leon Romanovsky , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jan Harkes , coda@cs.cmu.edu, Paul Moore , Eric Paris , Balbir Singh , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, codalist@coda.cs.cmu.edu, linux-audit@redhat.com Cc: Leo Yan Subject: [PATCH v2 2/7] coresight: etm3x: Use task_is_in_init_pid_ns() Date: Wed, 8 Dec 2021 16:33:15 +0800 Message-Id: <20211208083320.472503-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211208083320.472503-1-leo.yan@linaro.org> References: <20211208083320.472503-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211208_003332_752605_4ED57EA1 X-CRM114-Status: GOOD ( 11.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch replaces open code with task_is_in_init_pid_ns() to check if a task is in root PID namespace. Signed-off-by: Leo Yan Reviewed-by: Suzuki K Poulose Acked-by: Balbir Singh --- drivers/hwtracing/coresight/coresight-etm3x-sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c index e8c7649f123e..ff76cb56b727 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c @@ -1030,7 +1030,7 @@ static ssize_t ctxid_pid_show(struct device *dev, * Don't use contextID tracing if coming from a PID namespace. See * comment in ctxid_pid_store(). */ - if (task_active_pid_ns(current) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; spin_lock(&drvdata->spinlock); @@ -1058,7 +1058,7 @@ static ssize_t ctxid_pid_store(struct device *dev, * As such refuse to use the feature if @current is not in the initial * PID namespace. */ - if (task_active_pid_ns(current) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; ret = kstrtoul(buf, 16, &pid); @@ -1084,7 +1084,7 @@ static ssize_t ctxid_mask_show(struct device *dev, * Don't use contextID tracing if coming from a PID namespace. See * comment in ctxid_pid_store(). */ - if (task_active_pid_ns(current) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; val = config->ctxid_mask; @@ -1104,7 +1104,7 @@ static ssize_t ctxid_mask_store(struct device *dev, * Don't use contextID tracing if coming from a PID namespace. See * comment in ctxid_pid_store(). */ - if (task_active_pid_ns(current) != &init_pid_ns) + if (!task_is_in_init_pid_ns(current)) return -EINVAL; ret = kstrtoul(buf, 16, &val);