From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41722C433E0 for ; Mon, 18 Jan 2021 12:16:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EDF97221F0 for ; Mon, 18 Jan 2021 12:16:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403856AbhARMQK (ORCPT ); Mon, 18 Jan 2021 07:16:10 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:55926 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391005AbhARLu5 (ORCPT ); Mon, 18 Jan 2021 06:50:57 -0500 Date: Mon, 18 Jan 2021 11:50:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1610970613; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XXR+Mc7a0o6z548wc/iH8rqPTaynm5hoY17VRwgNENM=; b=IXxzHDqimWiZgKFPmVC1WBv0xRUewtX3XgojjDuUP+pLzCms7N/lnys71FfNOccCV0S5Zd T+sfvoyL8QgSmjdIeUrYNSggJ76js1hBlUvzndtNEMqPt1jEJP6zyTtP0UwjHGa4Ec9Wpg BDbdDXz01W1nqxrNz/YvrHVKPYgFv+W/NJliU2fvOOUmlPCb+WHQCXKx7sitf5gBcaI8aB j3WntrIHj44xi42D53Ohpj9HPi3IkNzg1mEZ36D4qBZa0vA8USrk1+sGO4pTVXImMyHuE8 /N7+oiIaK1asvW3zzLfMXw5dndUGE8nHzLkkB9xYI6M1JHamW/dE1uSjpboVPA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1610970613; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XXR+Mc7a0o6z548wc/iH8rqPTaynm5hoY17VRwgNENM=; b=aVJ9wTb/c52+0TSUoCJoKqKS75+ieS0GUaHYn+a1NRBK5iGU4fpHLEVcFG533eALScx1BB gXY2fiOs2Zt3NSAQ== From: "tip-bot2 for kernel test robot" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/misc] selftests/fpu: Fix debugfs_simple_attr.cocci warning Cc: kernel test robot , Julia Lawall , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <161097061196.414.17803528374854236962.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/misc branch of tip: Commit-ID: 443121b3ebb9025fd99ff11851d3537cb756d456 Gitweb: https://git.kernel.org/tip/443121b3ebb9025fd99ff11851d3537cb756d456 Author: kernel test robot AuthorDate: Sun, 25 Oct 2020 11:20:04 +01:00 Committer: Borislav Petkov CommitterDate: Mon, 18 Jan 2021 11:03:26 +01:00 selftests/fpu: Fix debugfs_simple_attr.cocci warning lib/test_fpu.c:66:0-23: WARNING: test_fpu_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE for debugfs files. Semantic patch information: Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() imposes some significant overhead as compared to DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe(). In order to protect against file removal races, debugfs files created via debugfs_create_file() now get wrapped by a struct file_operations at their opening. If the original struct file_operations are known to be safe against removal races by themselves already, the proxy creation may be bypassed by creating the files through debugfs_create_file_unsafe(). In order to help debugfs users who use the common DEFINE_SIMPLE_ATTRIBUTE() + debugfs_create_file() idiom to transition to removal safe struct file_operations, the helper macro DEFINE_DEBUGFS_ATTRIBUTE() has been introduced. Thus, the preferred strategy is to use DEFINE_DEBUGFS_ATTRIBUTE() + debugfs_create_file_unsafe() now. Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci Fixes: 4185b3b92792 ("selftests/fpu: Add an FPU selftest") Signed-off-by: kernel test robot Signed-off-by: Julia Lawall Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/alpine.DEB.2.22.394.2010251117180.2714@hadrien --- lib/test_fpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/test_fpu.c b/lib/test_fpu.c index c33764a..e82db19 100644 --- a/lib/test_fpu.c +++ b/lib/test_fpu.c @@ -63,7 +63,7 @@ static int test_fpu_get(void *data, u64 *val) return status; } -DEFINE_SIMPLE_ATTRIBUTE(test_fpu_fops, test_fpu_get, NULL, "%lld\n"); +DEFINE_DEBUGFS_ATTRIBUTE(test_fpu_fops, test_fpu_get, NULL, "%lld\n"); static struct dentry *selftest_dir; static int __init test_fpu_init(void) @@ -72,8 +72,8 @@ static int __init test_fpu_init(void) if (!selftest_dir) return -ENOMEM; - debugfs_create_file("test_fpu", 0444, selftest_dir, NULL, - &test_fpu_fops); + debugfs_create_file_unsafe("test_fpu", 0444, selftest_dir, NULL, + &test_fpu_fops); return 0; }