From nobody Sun Feb 8 09:10:49 2026 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 1FAC22652B7 for ; Sat, 20 Dec 2025 21:56:23 +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=1766267785; cv=none; b=BpKKHY8oArcuU6DWHUaqnHgWeMZsG0e2N6Z2TS3EFxqdAjVuFKEViKTvYp6KFSnyQFu/cOQAAZdmgP5Cx0qu8mEfHKqqlCsZGB/pe1vXcFuKy5WfHOI5mX/bH4P61ffZWGf8KMzQef+OOMILH+PdolELCYbqffDsFKbQfOxuz6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766267785; c=relaxed/simple; bh=Oidm8DV6oXpHE80i2rL3BbYaHeMTgxMXRuMNEofi8hU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=grVvBpE8InlBfUCpbKZ+FbwmQDUfZ7vB9yTLPiV78CPVqFYIcejfRX/tvBMu7vEqOJgU9fBbi40j++WsLyIn9i2Ovb+7O8Ow1baVyuZxBwFx/3T8a2RU5yzegHW6KSNlh9mbItCzH6HzQ/L/NWghOCflEd9u3ZuabSpRFxMHKvk= 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=I2ZeIdQ6; 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="I2ZeIdQ6" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-47796a837c7so20164145e9.0 for ; Sat, 20 Dec 2025 13:56:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766267782; x=1766872582; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=itp06tZNT8FGE8leG4kKklc3k+SPxyVzh2FPT8GGFTk=; b=I2ZeIdQ6Sl1a4g9dIT5t8tc1ctJwUZ1lOm4VtkOdkfSJmlHgVt++wiIUwl1Fq9ro5j RAULz0KZdBa32/jT3vH3aIG4R/6XQ0+Fo+cNXb6RnwsKxRKB4saiiK/vv3jIC2twEVxt +lMIS/iHAFAkZ0wAg5W4B/pSw2EI1/Xmpks6+u3iuuL9MOtqjQLX5WqSgHFP0J+wboq/ XwByax2vZusVmskQt4YEkTR0waROoY0U2LZxOj6teCFwA8iFiCc6lzRd4s4qYoCJEVyI HpkQKaowRIAyOf0ppKo2cLK9YSabXWRvSRtNq+jimSZRkwWyOe//n3a7qYXeYjFtg1qb A+PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766267782; x=1766872582; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=itp06tZNT8FGE8leG4kKklc3k+SPxyVzh2FPT8GGFTk=; b=a4ALQXTxV8Xw+xSJBdhA7MFuxuowqTXr4J8EMZGfivQHNNTljbL6N8R4otAttjz9NJ 6ngPQbuAso1vTajmudo7BtkJb1nLiPrPICIPsGVYwkFJWkixMNcTGJ6XZMoRi9DpZ19N CWqZRtouGm9BxJDQlbco8FTL5U9BFMTBuYumjAu3+xxWev7rUz3mWej5O9zq9i6gi4XC pJjn2NSdmnpozoEhgbuQxi4y8Yir8JZ5Qmd5EBzLEQrFOylFO6W3bv7hM7MtydJ7+PBA Yb2B+bz5Xj0lJwhQs98rOVJE0gxvF7k5EtnFk2IwJyALbE/5Xld6wMEaHS4xkto2Dcsv 2tfA== X-Forwarded-Encrypted: i=1; AJvYcCWAlS3PfqtA1ehowy22q4RtZFpVmucJ1TPJ9fccvhdzIb1Bg2HT2Y3p4YOw+rs3R1//78nPvQ8qrPaVEFE=@vger.kernel.org X-Gm-Message-State: AOJu0YxulYbO50RCUd6Zcl7EZdYYyh4IS1ChZs/Lx/6GPCtx7EJV4Pe6 QZH35xACR/Qv2HplQJ3vvOB9gpH9evf0jQNaIY6AsRdP5aQ54YTsOvoZ X-Gm-Gg: AY/fxX40Pqynf1px8yz5NBsicWoC91COytL2UotZQA2BTUBK8l15uqmp7woukANdYo7 402vc8hKrFEn8uXQtw2CCAkAUBcD9DAPgAc/M6N6n8+PRoGLhBqWHJTRhV+83FlY86PmLxBk0cn ubJ1viYmcf3IKHP2gN5GFmiqHcAySUf5e2w92RZeDLvfyPQeFp7X3xozSHp53/Os8PDfEeuEu0c KtoRgklbad6c5eW0U3okUZr1jQ12ioYYyVPXGf5v5zkCbELmehQOOaSBy/QFd/wUx6kjSdVYwns 8AGt6VaBm+RahAZWsEs2O8lYcGb5fyc4N9qek4Yf6WlC01umTmx+4RE0BcN3C2y/q4Z7uagwDal yDu0ZCtkasZ5OuSG2b2WkORdUmec6XXePN7RvT6pfFNAelJCL0MObGlIMMpdsiwhvslJFR25vN7 M1jE5zhR+Amesbul+/5AQtM7YEA1pfGNaUx+2SnqNdeC2L8BZUkKTHvQhpssXe48jkG9YNaGTl X-Google-Smtp-Source: AGHT+IGRznDP7O2FLvFlsVlKokPRLhTsReyNgzeIu3Zf2ecvIx0/z8KCHGXEJhCGwxamUAw1yHIh8Q== X-Received: by 2002:a05:6000:2387:b0:42f:8816:c01a with SMTP id ffacd0b85a97d-4324e701ea0mr7985145f8f.62.1766267782173; Sat, 20 Dec 2025 13:56:22 -0800 (PST) Received: from snowdrop.snailnet.com (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4325c052d34sm3601755f8f.25.2025.12.20.13.56.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Dec 2025 13:56:22 -0800 (PST) From: david.laight.linux@gmail.com To: Thomas Gleixner , Linus Torvalds , Peter Zijlstra , Mathieu Desnoyers , Kees Cook , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, Al Viro Cc: David Laight Subject: [PATCH 3/5] uaccess.h: Use with() and and_with() in __scoped_user_access() Date: Sat, 20 Dec 2025 21:56:06 +0000 Message-Id: <20251220215608.434614-4-david.laight.linux@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251220215608.434614-1-david.laight.linux@gmail.com> References: <20251220215608.434614-1-david.laight.linux@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: David Laight Wrappers for autoterminating nested for() loops have been added to compiler.h, use them to hide the gory details. Signed-off-by: David Laight --- include/linux/uaccess.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index c5d5f2d395bc..589cb2ef2e7b 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h @@ -751,12 +751,10 @@ USER_ACCESS_GUARD(rw, void) * Don't use directly. Use scoped_masked_user_$MODE_access() instead. */ #define __scoped_user_access(mode, uptr, size, elbl) \ -for (bool done =3D false; !done; done =3D true) \ - for (typeof(uptr) _tmpptr =3D __scoped_user_access_begin(mode, uptr, size= , elbl); \ - !done; done =3D true) \ - for (CLASS(user_##mode##_access, scope)(_tmpptr); !done; done =3D true) \ - /* Force modified pointer usage within the scope */ \ - for (const typeof(uptr) uptr =3D _tmpptr; !done; done =3D true) + with (typeof(uptr) _tmpptr =3D __scoped_user_access_begin(mode, uptr, siz= e, elbl)) \ + and_with (CLASS(user_##mode##_access, scope)(_tmpptr)) \ + /* Force modified pointer usage within the scope */ \ + and_with (const typeof(uptr) uptr =3D _tmpptr) =20 /** * scoped_user_read_access_size - Start a scoped user read access with giv= en size --=20 2.39.5