From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pdx-out-004.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-004.esa.us-west-2.outbound.mail-perimeter.amazon.com [44.246.77.92]) (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 2244E32549D; Fri, 17 Oct 2025 09:08:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=44.246.77.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760692142; cv=none; b=U4KdyrrOd3Wdibq8deEtGzm1QzY7JpV0a8ZfrFb+A63R57Ml4DuwztH3LeO5H8PQi5Y977S3Z6hKRz/3R18z7mdvVq+S8+48rLEq/zSeqd57BgTO9sZhPPurUn+Tk3r8Aqa+tKf1Cow86RiTnBHXfyF+Vqfwrn+jmMQoC8gR/bo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760692142; c=relaxed/simple; bh=23s8l0G8LMW/LqgoII7VfOWAq4ph1Dyt0/EjDFoB5Tk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dmlKm67VsNwdJveY2tSPQHzX39kGMW09EqA3KHpjacBbhds1j8BLfEXwwJJyodZwvBRmvdMnMTAv0OyJN3lB7jnHtGVpmwG5gB3UMrfPUhVDz2R6etPEVvwImGek+vp4srPJnaXFIrBjsg4jgASzNt4w23TH853QE/Yu4npmfmY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.com; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=XMBLyhlh; arc=none smtp.client-ip=44.246.77.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="XMBLyhlh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1760692141; x=1792228141; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=M14+Hrw3+0xfvL7LtAKdftp5KA5xdtXGebEkX3FEMMU=; b=XMBLyhlhX9zVVX4HBT2Eo5pj9XZvJt1HshVbSPCn+hP6Frw3/A1OcoJi DbYde5QcTF0u18rZ+lam/0Howa8mspt+6RWYW/S05N9jmotBRH3h6nrbK q34Ufxqx7hyG+zkjCuiUGwWNgledqA4EA4428y3eZP81pj1+9QKrOuLNn +UhhIS5JRezCTw9s+cSIYit+oDgxMsFsaZ7ahX/lic8y2ishmh7y3ST1u 41XKLgfXuTrzLrJHSacVM5tjI50uQWwyAErWGH3T9U1A/CgZmB32+j5J4 YAL5M6cg9DlXONm68DnR8vXbK4S/UddFn4/La9fFdgzNLYJyfbiX7oUqg g==; X-CSE-ConnectionGUID: TBZJv6geT3iQADNt+rwklw== X-CSE-MsgGUID: yHuVWYCBSRGy3/ljdqeQsg== X-IronPort-AV: E=Sophos;i="6.19,236,1754956800"; d="scan'208";a="5070261" Received: from ip-10-5-0-115.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.0.115]) by internal-pdx-out-004.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2025 09:08:55 +0000 Received: from EX19MTAUWA002.ant.amazon.com [205.251.233.234:30812] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.42.150:2525] with esmtp (Farcaster) id 3a32b82d-fd92-4e0c-94d9-173d12ce557b; Fri, 17 Oct 2025 09:08:55 +0000 (UTC) X-Farcaster-Flow-ID: 3a32b82d-fd92-4e0c-94d9-173d12ce557b Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWA002.ant.amazon.com (10.250.64.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.20; Fri, 17 Oct 2025 09:08:54 +0000 Received: from dev-dsk-farbere-1a-46ecabed.eu-west-1.amazon.com (172.19.116.181) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.20; Fri, 17 Oct 2025 09:08:39 +0000 From: Eliav Farber To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Christoph Hellwig , Linus Torvalds Subject: [PATCH v2 11/27 5.10.y] minmax: allow comparisons of 'int' against 'unsigned char/short' Date: Fri, 17 Oct 2025 09:05:03 +0000 Message-ID: <20251017090519.46992-12-farbere@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017090519.46992-1-farbere@amazon.com> References: <20251017090519.46992-1-farbere@amazon.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EX19D035UWA001.ant.amazon.com (10.13.139.101) To EX19D001UWA001.ant.amazon.com (10.13.138.214) From: David Laight [ Upstream commit 4ead534fba42fc4fd41163297528d2aa731cd121 ] Since 'unsigned char/short' get promoted to 'signed int' it is safe to compare them against an 'int' value. Link: https://lkml.kernel.org/r/8732ef5f809c47c28a7be47c938b28d4@AcuMS.aculab.com Signed-off-by: David Laight Cc: Andy Shevchenko Cc: Christoph Hellwig Cc: Jason A. Donenfeld Cc: Linus Torvalds Cc: Matthew Wilcox (Oracle) Signed-off-by: Andrew Morton Signed-off-by: Eliav Farber --- include/linux/minmax.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/minmax.h b/include/linux/minmax.h index c0e738eacefa..842c1db62ffe 100644 --- a/include/linux/minmax.h +++ b/include/linux/minmax.h @@ -26,8 +26,9 @@ __builtin_choose_expr(__is_constexpr(is_signed_type(typeof(x))), \ is_signed_type(typeof(x)), 0) -#define __types_ok(x, y) \ - (__is_signed(x) == __is_signed(y)) +#define __types_ok(x, y) \ + (__is_signed(x) == __is_signed(y) || \ + __is_signed((x) + 0) == __is_signed((y) + 0)) #define __cmp_op_min < #define __cmp_op_max > -- 2.47.3