From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailtransmit05.runbox.com (mailtransmit05.runbox.com [185.226.149.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 190E82F5B; Wed, 19 Nov 2025 22:42:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.38 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763592159; cv=none; b=gte9o7jZaHXrSU1jSOFajSXcke2UbYOJ2/TRfNytujHx8E36yh9g310MwXGg3OTwLVzjzf+E8CZeaaRFxEsV0FUP85fdU5w5VrPbd8pL9EeFiHVUqNt44NQ5bUB++qSQsgK9RDEP3pGfD7ZetLs8+fAKck3UD35bAqYdSUHPdA0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763592159; c=relaxed/simple; bh=tt/IMPwEpLQecANGcddj+ukYcGqvpvlJ/TqDtm477Es=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tddBeuw9O173FsD6mWAJ6xPhc9hCljfl647hskyPFBLVDqv59OAHm5r2Uhs5vO5Q5+CoLYOWmS41sNDR5U2qmEQcd9MVBy1J0ZUDkmcFmycKkDwTec0qCEx9/wgVLj+MbFrL0xd0gy/GRJDxhb1rEKkI3uaPkj39KUU6RKTnljs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=runbox.com; dkim=pass (2048-bit key) header.d=runbox.com header.i=@runbox.com header.b=EeHoapDu; arc=none smtp.client-ip=185.226.149.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=runbox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=runbox.com header.i=@runbox.com header.b="EeHoapDu" Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1vLqsm-006ksN-1P; Wed, 19 Nov 2025 23:42:36 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector1; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To :Message-Id:Date:Subject:Cc:To:From; bh=FJlg4ul1sq6ZIhYuGCfri+UArhKIFxhGhDxLLUHAweI=; b=EeHoapDuKaTV8lNNWBHRSinGgN oGrN6E8WJGCGmQ/UZ8Jwwc0T7nrGHIqcSMnb8z/cZxhehiegTm/tshgB/kN4QR4hVhN9eSZwduGls 2PFLLd1+qwVa7We6HZ1csXYxMfEmciCyRSkMBIcruVyXpLS4RGdBf4LtH3eqk7bBBLCzERwb2FSI7 o9AlR4YV0O87T+tBljrwFgRuuzcQHRkgp8bftdjF1VkA2yXvs/KBIROiR6KWWjhC32bk7bf+h6q1Y Ub+//bZuqPHi3FznD0eTSB+kOmeKwg/2l9abP2d5lW5Xu4ncplHgmJSiFao5JzXAw62EDEkir/tYT fSWzAu0w==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1vLqsl-00080B-EF; Wed, 19 Nov 2025 23:42:35 +0100 Received: by submission03.runbox with esmtpsa [Authenticated ID (1493616)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1vLqsd-00Fos6-6X; Wed, 19 Nov 2025 23:42:27 +0100 From: david.laight.linux@gmail.com To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Bartosz Golaszewski , Linus Walleij , Mika Westerberg , David Laight Subject: [PATCH 18/44] drivers/gpio: use min() instead of min_t() Date: Wed, 19 Nov 2025 22:41:14 +0000 Message-Id: <20251119224140.8616-19-david.laight.linux@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251119224140.8616-1-david.laight.linux@gmail.com> References: <20251119224140.8616-1-david.laight.linux@gmail.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: David Laight min_t(u16, a, b) casts an 'unsigned long' to 'u16'. Use min(a, b) instead as it promotes the both values to int and so cannot discard significant bits. In this case the values should be ok. Detected by an extra check added to min_t(). Signed-off-by: David Laight --- drivers/gpio/gpiolib-acpi-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-acpi-core.c b/drivers/gpio/gpiolib-acpi-core.c index d441c1236d8c..83dd227dbbec 100644 --- a/drivers/gpio/gpiolib-acpi-core.c +++ b/drivers/gpio/gpiolib-acpi-core.c @@ -1099,7 +1099,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, return AE_BAD_PARAMETER; } - length = min_t(u16, agpio->pin_table_length, pin_index + bits); + length = min(agpio->pin_table_length, pin_index + bits); for (i = pin_index; i < length; ++i) { unsigned int pin = agpio->pin_table[i]; struct acpi_gpio_connection *conn; -- 2.39.5