From patchwork Fri Feb 4 13:50:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12735089 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 4B4ECC433FE for ; Fri, 4 Feb 2022 13:52:43 +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=TK9wXZ8lbQhN9WdvWXCRMVJ77kmjKOFnVhc1+cj2mm0=; b=FnPH36KAWDyGPr Ikb0XkNo+my8emH1DyKc3BxyUKKMUDwfpqKwRS9epyKa/Wv4VaQasTtdV+bSflI6teiZ3K87aaJYB t+hFJ6ruXCUwI9KyV5EaXhD8qos+ATdpCGdEOCleXBRbeZ9+ct7nblz+Lu2FHdFAqyxPVNGrgjwd1 l5fm8o/NP0UCsqw8UcC9rm4239xHM65PH1o1PpIU9zom1HBTGAT2lTyrF9VLA4sojtVb4LzLdvbfu Jgy/74eWgY+fNaButWksVZ/4S6/Ade8uKULqqZnumYXJWTuH9D0jeqJ80V8sYy+kGzMPp1ryvgINC EctNFsYdB386A84v2CNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzn-004Raw-G5; Fri, 04 Feb 2022 13:51:27 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzc-004RY0-8Z for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 13:51:17 +0000 Received: by mail-pg1-x534.google.com with SMTP id v3so5111029pgc.1 for ; Fri, 04 Feb 2022 05:51:15 -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=Ond/4ABfTjnzyDWR3gs46S4b6+8tS7qKpB/Y7mDbdaU=; b=wmlsCgXM1ZaxWZmmTNRiTDHSrz4QZlpOzZcHzw4wQJiCEZCQAFYI8HJqRGCtWiyhW5 A6RdVRtdiDEoKdYM5Sop7Q2XFzudD/dkrNdDU2rPne5G+FoBWunbKI5WkgjDbHZgsgPg slaahwwbp5z0P1jkNYAz8ukILBZ6mD+OwGKo2xDeSis+I39UgyeucUSK7LuBZYjhu+wP Sfz5xV4T0dF/fqK/mJ/TfKm7yzf5/EQes4xKNNMNQNT+1CiAnBzqKz6Bax9uWY/2Ehlz EXVuhXuXUTZC8c0wzkDmoYJOZykctJNjVnnyXYOIdmTnbTA1keOgnEWuW00zyLhaXwyB svoQ== 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=Ond/4ABfTjnzyDWR3gs46S4b6+8tS7qKpB/Y7mDbdaU=; b=TSc7Z+2zuUpaqH9PCO6OwoNqlJ4wFcGakuAuyXkZ7kthv3NhcFzIOt6lIJnH9e6VRg hab6c33TjAdjAIZLI9A7RBlACfUBYYZqZMQKFGAbll4PiOhaM5nzGIV4zUAs0b3RI0Nu Iw0qJNuSfKcrqhdrdh5cKSdtFRqeQiHKTYZZ87lo0TEL4ZrumdSlPub4nSFMYUr94JeL BV0eqZTtZEnxeqnzSXY1HugI83HPkZFGoalVB367gPL8kfHyhEqoI5iEfqg1GmZkni6g 335Mxu5kL5DXdEueY4qYzgA4sZFR0pQmZDQ0bMkgROdaU49TZdUZ9mzk5glXduxK3CLG allQ== X-Gm-Message-State: AOAM531KFYJ7Q/BuCIuwRchfj51DLHPdCLQrxF9XZAxsEc8UvAgwgSRO aeSKgA8YLXddCHwnFsK2pvX/Kg== X-Google-Smtp-Source: ABdhPJwuvtNdZ9Ta6hHt9CUE+CDUNaZXCQXeOpieEryVkd24lqRO4trnQ3j/8j76oVJ/K1+jjs/4xw== X-Received: by 2002:a05:6a00:804:: with SMTP id m4mr3169177pfk.45.1643982674946; Fri, 04 Feb 2022 05:51:14 -0800 (PST) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id 13sm2668131pfm.161.2022.02.04.05.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 05:51:14 -0800 (PST) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jan Harkes , coda@cs.cmu.edu, Paul Moore , Eric Paris , Balbir Singh , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, codalist@coda.cs.cmu.edu, linux-audit@redhat.com Cc: Leo Yan Subject: [PATCH v4 1/5] coresight: etm3x: Use task_is_in_init_pid_ns() Date: Fri, 4 Feb 2022 21:50:47 +0800 Message-Id: <20220204135051.60639-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204135051.60639-1-leo.yan@linaro.org> References: <20220204135051.60639-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-20220204_055116_323240_C2D24E4A X-CRM114-Status: GOOD ( 11.32 ) 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);