From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 A7139288530 for ; Tue, 13 Jan 2026 18:33:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768329238; cv=none; b=C8dXzI8bdh1S5flVAe4HgEnzQVnsrWdrUom6iUWPn9F6zxyLNNRvi6UZWo5g36W4LmgxXV4WJaoX9072U87qPVyXBGmtEzTrH/QME5ZOWTYEvV7xKu7ljVuS4gdmsE6elc+4+mgN/IRqIFnJuoFPq7+IKJIBzvS2TWIr6Ennnoc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768329238; c=relaxed/simple; bh=6wclnzskG/ZNUGRCGnmIpcaafQeAFLYeRrSPFRj2hqs=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ieI7OQrCDPUZq9m3IuhaIcpQxA+OgtfSdKQ0JuHl7eLujqZYN8wBA/DQQjBBjdb38mwhh+VeO/rl5Iy7HxfJApRKA+ypjvIsKv8TXS08Sj4ehOv5U++WQmz24qtezoYVXOT8hn333UZYUFVNSWeyAS2vJ0JjshP4ZQQArQi3jqg= 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=fpXDyFTc; arc=none smtp.client-ip=209.85.128.51 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="fpXDyFTc" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-47edd6111b4so7346825e9.1 for ; Tue, 13 Jan 2026 10:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768329235; x=1768934035; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=vD1n4fofwsxFZx8Y9vmmRRviFzIkQGtDaZlhVkXmiq0=; b=fpXDyFTc8V6sAVOSDINivucVs1f4NXdjVYCAxga1I5uBIi1ZWxwLWNjyILra1ili7g xvlgd2n76SMKRu6tg2+xoWJ4UbTVsY27n1hae/ziMsk5z3zVif2stqQQe2+HTy3sONEt AmXX3HGBbrrKwaDrpkFGYrmj1LziZmAXi/HsB5OhBpEPtRDandzpixZ1tG8qr260Tnrq bS9H01/oRXM4bN7F3ZxfM6dS6gu4UA5eZsUJXZ4AoxAWf9zqGZ+QkcT6ucC41b4YnDnS f228iaceH9Rc3GrlUcIQCKOycY3pSqBijd9+B43GrASJbFhhq3Kck4GS/+o7cM569Xh9 WvAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768329235; x=1768934035; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vD1n4fofwsxFZx8Y9vmmRRviFzIkQGtDaZlhVkXmiq0=; b=L3OF1gAX9k3RQhoDNa4rHBTMIcnSS+XQUXJz+87HZlDExw4ozfjIS01asuwyLleUzn wEidE0SUkZnB7UOOyR9bBIYEqFeouvLcW+2uIaCGlPX+zH4O0eynNGCiucUxKyymcWcG q0J/vflx4T8gxQTjktEh4pUd7/rFZxjlZyqh7AWfudvOXVJXnwYCX5AjwmFScWIgqp6K RD1X9EM8lEMw9cMRG7utyJrV3fGXkr2k9hFBHk7hnPZVGkuj1KQECP+sib1fW48mzJ3d duHJ71ywv/HY7qOLVSPHrl1lDC8b+5DJEypMeAfV4ewsZai+5C46C4yLuc8+cFj1wLxf XoYQ== X-Gm-Message-State: AOJu0Ywebgn8CDseGHfr8VHkBOf9p00p/1rhYBcdeOLUoTT38v5/zn/g y8zcXYneCPOzRTuY/K0HUr2tBF1qHxKHX1wyzbFmYLGTEmHUQNUPD97u X-Gm-Gg: AY/fxX7Bq1zyEJvC+2Iu7wTWCT1DOgLW1CR6k3iCHiMLn1uryBnBXOqysSy8ReKIN1V mzSXW/4z+3pjQRKlTvV2xf444naDzaCif/0Z4rw04SldEpT6mAE170jaoaxWz5AsFX1u1H1dDin YzEun24bRg/Zx28E1H79YAu17M4ASMXD9Bknlh6rMaYBbv0QRE1mQvnLXtnk5yLOESzrIwcZXlh C+O2j3F9eUcTIqblzgoC007H9ZLX3jYWo+CP4aIUJLTdx4FHrr6q9T4oGE6auIqy+7F5rxd3LLo ANxze2GhsrcPxdmjyr+g8u9hIq3o4dLOFAeJxYmnJ/KTdSReBSeU1pcXFDp0IhId7JKrgvav78y MjR64yeHefpi4EiBfNj/t57Mj/UDxTmBgTvERXzo5jzQK0FagcUDdkrrel9FIlXuiZ6rshhsO1A kl44X66bQ6fj0SAzZ03gbXKq0XwhKEt2SrLNM59c9MoMQuLM/m8x+vkQd8fHgH5bk= X-Received: by 2002:a05:600c:6386:b0:47d:403e:90c9 with SMTP id 5b1f17b1804b1-47ee32fc6d8mr1578295e9.11.1768329234806; Tue, 13 Jan 2026 10:33:54 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d7f69e802sm426004125e9.8.2026.01.13.10.33.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jan 2026 10:33:54 -0800 (PST) Date: Tue, 13 Jan 2026 18:33:46 +0000 From: David Laight To: Mark Brown Cc: linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Alexander Viro , Andreas Dilger , Christian Brauner , Kees Cook , Miklos Szeredi , OGAWA Hirofumi , Theodore Ts'o Subject: Re: [PATCH 30/44] fs: use min() or umin() instead of min_t() Message-ID: <20260113183346.18ef7c74@pumpkin> In-Reply-To: <62097ec5-510e-4343-b111-3afee2c7b01e@sirena.org.uk> References: <20251119224140.8616-1-david.laight.linux@gmail.com> <20251119224140.8616-31-david.laight.linux@gmail.com> <62097ec5-510e-4343-b111-3afee2c7b01e@sirena.org.uk> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) 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-Transfer-Encoding: 7bit On Tue, 13 Jan 2026 16:56:56 +0000 Mark Brown wrote: > On Wed, Nov 19, 2025 at 10:41:26PM +0000, david.laight.linux@gmail.com wrote: > > From: David Laight > > > > min_t(unsigned int, a, b) casts an 'unsigned long' to 'unsigned int'. > > Use min(a, b) instead as it promotes any 'unsigned int' to 'unsigned long' > > and so cannot discard significant bits. > > This breaks an arm imx_v6_v7_defconfig build: I hadn't tested 32bit when I sent the patch. It was noticed ages ago and I thought there was a patch (to fuse/file.c) that changed the code to avoid the 64bit signed maths on 32bit. David > > In file included from : > In function 'fuse_wr_pages', > inlined from 'fuse_perform_write' at /home/broonie/git/bisect/fs/fuse/file.c:1347:27: > /home/broonie/git/bisect/include/linux/compiler_types.h:630:45: error: call to '__compiletime_assert_434' declared with attribute error: min(((pos + len - 1) >> 12) - (pos >> 12) + 1, max_pages) signedness error > 630 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > | ^ > /home/broonie/git/bisect/include/linux/compiler_types.h:611:25: note: in definition of macro '__compiletime_assert' > 611 | prefix ## suffix(); \ > | ^~~~~~ > /home/broonie/git/bisect/include/linux/compiler_types.h:630:9: note: in expansion of macro '_compiletime_assert' > 630 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > | ^~~~~~~~~~~~~~~~~~~ > /home/broonie/git/bisect/include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' > 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > | ^~~~~~~~~~~~~~~~~~ > /home/broonie/git/bisect/include/linux/minmax.h:93:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' > 93 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ > | ^~~~~~~~~~~~~~~~ > /home/broonie/git/bisect/include/linux/minmax.h:98:9: note: in expansion of macro '__careful_cmp_once' > 98 | __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) > | ^~~~~~~~~~~~~~~~~~ > /home/broonie/git/bisect/include/linux/minmax.h:105:25: note: in expansion of macro '__careful_cmp' > 105 | #define min(x, y) __careful_cmp(min, x, y) > | ^~~~~~~~~~~~~ > /home/broonie/git/bisect/fs/fuse/file.c:1326:16: note: in expansion of macro 'min' > 1326 | return min(((pos + len - 1) >> PAGE_SHIFT) - (pos >> PAGE_SHIFT) + 1, > | ^~~