From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 64789346FA4 for ; Fri, 5 Jun 2026 05:47:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780638429; cv=none; b=qii8RSYVqMkPGkzcQCux2V98cCcJS1HBvgcz3nwu/D9T7IhsyWH2rIrd2xP4u1ZeB6LoPgEbCaljWwXwDq7PyZrgZOn4IbeGd15nXkqyLlygCbFR8/78p/tk3IQr8a5T+algRPJAlAZNioY292WsrQ6aqpDznHZcAZ5yckOJx7Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780638429; c=relaxed/simple; bh=aJTgQ30kt0uFdu2pZY5iDO3RjT8mlphDE/zuDEG5amY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MZKE/+wf3Pdp0gBudJtmOUbmbjZWZQhkyGCm9vj4gEt6oo6ty2DTy/8RWfuHfMMSqweLwmlILtvCcQa4q6u2qBDpzKB+I38DP65NuT/EZ7/u6AcYu9f+Z2qyPoGy5yr/DSznV5Jw6liAbF/W8VYzN2rJTNI4XHIu68scCEG94z8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GvCeTLbg; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GvCeTLbg" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-49068493267so10743655e9.1 for ; Thu, 04 Jun 2026 22:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780638427; x=1781243227; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=fjDrLfKQSx9/iTAOpM8mEBvBfa+kxAhmd9fKCaMvT60=; b=GvCeTLbgvmiBOLe9HbMDmGyt3JsHd9G2hb/OlY67t72HdRyE8eakJDHqrzOdDp7Kfa C1tZls0g9zqkJVmZ2vCLxJPC3tO2BjED6BJ7hHMTk+YIIc6KjRJa+OQImlJob7PEsFG6 MadrEcIOhH9o/0Ptilce89+jx8B78KUoaKrnfsoI0UUkrJMP80AAERq9tQ4juA3M/0xc cqLAmaBe6Cls/xBe9tO12hXjFti6h6Vrl0aMyaCdZYYCXZkbHpFXrtoe2xVzJcl+iS9m kCCz4iK93+4lB/XyAAdLNUGDf5qsEDdgaD9JKVIyn4AicBHyJ4hrIk6nI8HisvgQLgw9 rzNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780638427; x=1781243227; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fjDrLfKQSx9/iTAOpM8mEBvBfa+kxAhmd9fKCaMvT60=; b=RS2mbeSkhq5i1TInIIPeugvPP/geGRoSQhb6Jmc3f2Dl3uL18AiV1+iHnOfDmPWWCc TASeAnApQISxnn33THLdLvUKJCZe4p+D9WTNDbmIAbiXFZLJypNz88ngwA9nfI+lF+GE ZjMFttH9c74gCdUSSRSyYg9P+jM2KO5BIprbxsxaXec0w4ClGBk5M8S276xk+PWZjv1z ASpst0NJejf/UORlqxFDo/ksl4yQw98bNwOvtQ6cTIrS/zvszQjfZTtJXckHK0X6gNep rtEwVcoEcMSFBWy/U5BS539RV5S4OMXFYvtFIZJbndGtdhTlisGhopqS6sblD5FIjQpV Kcjw== X-Forwarded-Encrypted: i=1; AFNElJ/okNXeqIt53eo+usz07WFC3NwkiYFYsGxhZoR4jZ9ewFsaTcqirm4sSrmb30JbcFOPBY4FxNQITQQin60=@vger.kernel.org X-Gm-Message-State: AOJu0YxcUhq2lkx1h7dURt2pxa/RS5lMFXp2yRK5MefkahcxZBuGzw3v Tn0Znz1K58na3VxMYjRmrxNmf8fdJA93KIOuXeTUS/Vctp8NXD6L/sE0 X-Gm-Gg: Acq92OF/dQ68qD78QjKSfEhJA/cceriQGKPoCBEiXLKRnfTv+g1kLsqKMFbbFIuG1yl e8OyFpWaKf6KwCVbDmvQe88ceH9SN8/H/gkigApvsapT0FfyhHhkjVIunWAmhyXMQClckDnZ6l1 bA9mNNT6nR3Re4acZ93Konm10CM5efLP8yD8xtU9RA0cpbOyBo502K2KEXjLThNZ9AMeWxo6y6l inQfrNJmzH0OTtfCeeEjjeABysQIJ8R0Ac1rjAkD0m1j40BxzHUpNKy4Pdk/HujPWFdyQy19vsS 7hesz54jxdCgB7ZTr4qICdDihJ1sbxUFo0fdhAHZ0lxOvieR/9WHTEAjj/W9qvhSQH6ExTjnEzh exnhpbY8BzB94FCaeI5azVRmlzmZv4C646YBl/OGij6Qjnczw2pR78uforCLVkbZitMy/2ya/Iq VK6K+1/cCrdZe2575h0IHCmDcvhit9fA== X-Received: by 2002:a05:600c:c493:b0:490:bb3e:30c2 with SMTP id 5b1f17b1804b1-490c25f1682mr28690675e9.18.1780638421991; Thu, 04 Jun 2026 22:47:01 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f2ec711sm21676813f8f.12.2026.06.04.22.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 22:47:01 -0700 (PDT) Date: Fri, 5 Jun 2026 08:46:57 +0300 From: Dan Carpenter To: Dmitry Ilvokhin Cc: Peter Zijlstra , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Miguel Ojeda , Thomas Gleixner , Christian Brauner , Marco Elver , "H. Peter Anvin" , Andrew Morton , nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-team@meta.com Subject: Re: [PATCH v5 3/4] cleanup: Annotate guard constructors with nonnull Message-ID: References: <85fee12eec20abfcf711443518e8f0caec982a86.1780064327.git.d@ilvokhin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <85fee12eec20abfcf711443518e8f0caec982a86.1780064327.git.d@ilvokhin.com> On Tue, Jun 02, 2026 at 07:12:52AM +0000, Dmitry Ilvokhin wrote: > Add __nonnull_args() to unconditional guard constructors so the compiler > warns when NULL is statically known to be passed: > > - DEFINE_GUARD(): re-declare the constructor with __nonnull_args(). > - __DEFINE_LOCK_GUARD_1(): annotate the constructor directly. > > DEFINE_LOCK_GUARD_0() needs no annotation: its constructor takes no > pointer arguments (.lock is hardcoded to (void *)1). > > Define the __nonnull_args() macro in compiler_attributes.h, following > the existing convention for attribute wrappers. Deliberately not named > '__nonnull', to avoid clashing with glibc's __nonnull() when kernel and > userspace headers are combined (User Mode Linux for example). > > Signed-off-by: Dmitry Ilvokhin > --- > Miguel, I dropped your Acked-by due to the rename. Went with > __nonnull_args() (over __knonnull()). Happy to restore your tag if that > spelling works for you. > Sparse doesn't like an empty __nonnull_args() at all. ./include/linux/spinlock.h:608:1: error: an expression is expected before ')' ./include/linux/spinlock.h:619:1: error: an expression is expected before ')' ./include/linux/spinlock.h:631:1: error: an expression is expected before ')' Shouldn't we specify the arguments which are non-NULL? __nonnull_args(1)? regards, dan carpenter