From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0071632ED37 for ; Fri, 19 Dec 2025 15:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766159144; cv=none; b=ekGR0WFEVWr/LHBCPQxFdR/KeyvVgaPKxJVe98qNPjnxzSt733CI44xAqrJKbHnyvvtJ8aZbR/NdvDIviNDOocbqCTESMkwyFw4kg8sLM+MQI8mBstZ4nTikA16lDu/SD9coFbK8E+WOR8UNQhDKrR5hB0yKNu5ulU1lUVO6M4s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766159144; c=relaxed/simple; bh=eXGkgk2np9CnqeU2wkxlYEOA75Yi53MyCAIm51ULRmQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=eJTfKeADPipeC18euPhQt/p2xqoufKFG3KG+fw5y+QSwWNZECx5BF2NtTA5gNK3uLyaPNhhtcEpt7fFB7eH5oh1krBjc/wFlfrEzHRbSLerM6+TW9ZaTb7Wn8TFF7XrqqYmZV9JMdvfa4jU+5hJO/ygyGefJvxUeB1ZtpuHY0tg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--elver.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=hHH5+bj9; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--elver.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hHH5+bj9" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-4775d110fabso15677555e9.1 for ; Fri, 19 Dec 2025 07:45:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766159140; x=1766763940; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Cp89rZHQypoAlOCNHCyWU3ytuEytNXkoLr0IcNjmOds=; b=hHH5+bj9mD08sRTK9V51sFdSChVwD0Dlk8kExvuhbyuSQt2nMrVO7SUz5wjXnBd0NC Ey16ADfJ8JTu+iWTLtsVwR+6EoNLmMEAcfgWqqNhRhnrTI/I89ttGn7TQeMWzweXNq7/ ajG1b4CAkZS6juXQxlYeM6TNHvxNHt9deQGn1YCJ/uO0rDtLwW3lT/azW7CLy6oK+z37 hKsrWG6WCBOvYtii+kHj3gwtjLeqIJR5HOBH8Cop9z2VuPZu0ICfRkW/tzOmD/5lYFO2 qloM8CRIr7p13snihP4GyqiAfFA9367HA2H9AhAMPjZfAYZJ6erIPiOfKBAdSIwcibLf nXvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766159140; x=1766763940; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Cp89rZHQypoAlOCNHCyWU3ytuEytNXkoLr0IcNjmOds=; b=RQq3HdX7wsSyqh9WKc/Mq8ZGB86L8ICm8vW1QegcIHUf9aPX7mX0jL2KSLeaQBv31Q f/lU8RemjsM7gEu86B9KJnsoL8gaeC9AH9PzXic7o1Esy12mO9ZkfBC6Xq/swDJ3yyIX mcOJxOTocNQc5vEvw7PG3OFAvl3ZU5x0j1XJEOf5MbK5bw3VFn/8dxjvXVBV+2I97Dl5 qzrk9A/oPOagxb9mjmlb3LFFHMXV2A+FGE1zyVPKTrc+NPTwV+9yjjtmKmSTFFqQhgGa VjhTKssTo1wGyQYymDcl45Iklko3jKcwlKxdccXUdM10GTXZoKJOy0WZr76sr1AXGaBH AOoA== X-Forwarded-Encrypted: i=1; AJvYcCUR4O9e/yIrs4OlJPBBTFecGIy/jJGxt/AAoXNDlqcQcTVRz9SirYY0r76twcGP6s9KxUWdl3cuLuk=@vger.kernel.org X-Gm-Message-State: AOJu0Yyse6bSiMpza4cbTLNmzm+OzR/FEUP0s9UEIEJWc4bR7AcHnoVl VQdv9R+FiGqAtH4fkN0e3GntoBmhZ/UNw18AsexOPw45h3C9hfOsK8hlDiEmchDKSmqb/RMleGB i+w== X-Google-Smtp-Source: AGHT+IEo4aI5AYzB6mIv/Q1TYzZNn72eZTN+KjN0BRtkpQb5xaIDLH0+DGUI6xvUKW6b1Bpd8Cf9msZmEQ== X-Received: from wmpy33.prod.google.com ([2002:a05:600c:3421:b0:477:103e:8e30]) (user=elver job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:a010:b0:47a:80f8:82ab with SMTP id 5b1f17b1804b1-47d1957f71dmr30483175e9.24.1766159140325; Fri, 19 Dec 2025 07:45:40 -0800 (PST) Date: Fri, 19 Dec 2025 16:39:54 +0100 In-Reply-To: <20251219154418.3592607-1-elver@google.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251219154418.3592607-1-elver@google.com> X-Mailer: git-send-email 2.52.0.322.g1dd061c0dc-goog Message-ID: <20251219154418.3592607-6-elver@google.com> Subject: [PATCH v5 05/36] checkpatch: Warn about context_unsafe() without comment From: Marco Elver To: elver@google.com, Peter Zijlstra , Boqun Feng , Ingo Molnar , Will Deacon Cc: "David S. Miller" , Luc Van Oostenryck , Chris Li , "Paul E. McKenney" , Alexander Potapenko , Arnd Bergmann , Bart Van Assche , Christoph Hellwig , Dmitry Vyukov , Eric Dumazet , Frederic Weisbecker , Greg Kroah-Hartman , Herbert Xu , Ian Rogers , Jann Horn , Joel Fernandes , Johannes Berg , Jonathan Corbet , Josh Triplett , Justin Stitt , Kees Cook , Kentaro Takeda , Lukas Bulwahn , Mark Rutland , Mathieu Desnoyers , Miguel Ojeda , Nathan Chancellor , Neeraj Upadhyay , Nick Desaulniers , Steven Rostedt , Tetsuo Handa , Thomas Gleixner , Thomas Graf , Uladzislau Rezki , Waiman Long , kasan-dev@googlegroups.com, linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-sparse@vger.kernel.org, linux-wireless@vger.kernel.org, llvm@lists.linux.dev, rcu@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Warn about applications of context_unsafe() without a comment, to encourage documenting the reasoning behind why it was deemed safe. Signed-off-by: Marco Elver --- v4: * Rename capability -> context analysis. * Avoid nested if. --- scripts/checkpatch.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index c0250244cf7a..c4fd8bdff528 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6733,6 +6733,13 @@ sub process { } } +# check for context_unsafe without a comment. + if ($line =~ /\bcontext_unsafe\b/ && + !ctx_has_comment($first_line, $linenr)) { + WARN("CONTEXT_UNSAFE", + "context_unsafe without comment\n" . $herecurr); + } + # check of hardware specific defines if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) { CHK("ARCH_DEFINES", -- 2.52.0.322.g1dd061c0dc-goog