From patchwork Fri Feb 4 13:50:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12735090 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 06EB3C433EF for ; Fri, 4 Feb 2022 13:52:53 +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=m8Zm9smoZfi35/3IO90E/+9OI6DECyB+rVhPkxjfEfg=; b=dz76CS/pxXR/qi XpY12n5AHJaPgbf9TXZY/FELlss1hLLF4rN5BKt2QkEEvaPPE8Iyd+QsKRkgmB5C9EUC6FXwGqMSN pHcocgBMhGr8pvmEawAewgCVBkymQeiFL2feWrFHZRlfh8LA7Og0ErMXCDipOag8YJ1hNuzbha0XH Jw4pfiyczsuq4Ocb4Nq2C1F3H4IQZBnJW5vgDZmVxJzH5umy2PIrrA2xxMlaDtxDa+U+b+/u4Wemq 7cu0LIUVG6yCmmySb2AnJNIH6saPIhGaRQTEfvFT2ug7UXKmZu0vOpxqzYPI6guZ8mLXpHpMhrd2v /A0uATuoTGqwbOc0sZ4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzx-004Rdz-AK; Fri, 04 Feb 2022 13:51:37 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzg-004RZG-UD for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 13:51:22 +0000 Received: by mail-pl1-x62f.google.com with SMTP id t9so2984462plg.13 for ; Fri, 04 Feb 2022 05:51:20 -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=gYlHTKZwf3eLsDFK6/setIM6v4QyZpE5drcppDSgIrA=; b=pC1m2fQqzS3hTahuKDM+7c0QgFbpmg/lU10YDP/xIO9xlFrADUvnPyylLcudQm3HwS Mzkkzt+rfEVA3WC0spzFoQljr9eb513PHecSpght3nP9WlMtWD82drPNmjTwj2mvE4Hw dda8ht3nPEpJgAN2CREnIOfJRLXHjHbQeB2ZhAblgc8q7hxEozF3onzdmNId7clG2bjG ZEcuTQGcQ4c13Pw562dtlPFppp2B2IJWZZ37JZn5MAfn6uEuGdVTV77pnXlo4nMI3f7Z 5DK0AovtSLJeoY5vHqtvQx1s9VVbD+XNEoRLYXqeTTG7T9xy4bGxsPnJg085fug37uZQ 5CBA== 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=gYlHTKZwf3eLsDFK6/setIM6v4QyZpE5drcppDSgIrA=; b=EbfGk6p0wprvsVleCUgUz/4Cu5z1YfCw62xTt4g+RFS8H9csP9tYkqD3gqahewyrfw PczJrKFMorzHmKhw1ZCf64is29hGsgx+DGRMvkYadEodYKjFUMJgnsqmdAvkzoTC+OeK naSbpBo6Tw/XXxtd3siGfuR3AQFOv7uapT6czgM/WFaifFTFvtNttKg5LFPnfm6+rjIM GHOGO5MwxLxRe0w/ZPArfNoWqJYjU0YyV3JFiJLvu/APWHszQ3BllTkqVo5yJm+yPNUJ DuoFI3918T5iIc0ThXKGdgVTJYposqriYyRVZc7BycIR20luv67/GWX4ZbdAp9v5DC9T t48A== X-Gm-Message-State: AOAM533eAGtpluPV4AH+sAi1AK09cfZZqQQYx4tyvcZae5nzlIhrvnpy Z/yHcgyJXhFbcOmjeKX6bsHxRQ== X-Google-Smtp-Source: ABdhPJy/zWH1p1cq5ydscrQgno2r1v4rJtuFkahMNvFLmLQ8bff4NDmYnoTUSpUlIlE29DeDFErTXQ== X-Received: by 2002:a17:90a:f485:: with SMTP id bx5mr3247440pjb.46.1643982679691; Fri, 04 Feb 2022 05:51:19 -0800 (PST) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id 13sm2668131pfm.161.2022.02.04.05.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 05:51:19 -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 2/5] coresight: etm4x: Use task_is_in_init_pid_ns() Date: Fri, 4 Feb 2022 21:50:48 +0800 Message-Id: <20220204135051.60639-3-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_055121_001099_F25F9A81 X-CRM114-Status: GOOD ( 11.17 ) 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-etm4x-sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c index a0640fa5c55b..10ef2a29006e 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -1890,7 +1890,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); @@ -1918,7 +1918,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; /* @@ -1951,7 +1951,7 @@ static ssize_t ctxid_masks_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); @@ -1975,7 +1975,7 @@ static ssize_t ctxid_masks_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; /*