This is a note to let you know that I've just added the patch titled

    minmax: allow comparisons of 'int' against 'unsigned char/short'

to the 5.10-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     minmax-allow-comparisons-of-int-against-unsigned-char-short.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From [email protected] Fri Oct 17 11:08:59 2025
From: Eliav Farber <[email protected]>
Date: Fri, 17 Oct 2025 09:05:03 +0000
Subject: minmax: allow comparisons of 'int' against 'unsigned char/short'
To: <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <rajur@chelsio
 .com>, <[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>,
  <[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, 
<[email protected]>, <[email protected]>, <tipc-discussion@
 lists.sourceforge.net>
Cc: Christoph Hellwig <[email protected]>, Linus Torvalds 
<[email protected]>
Message-ID: <[email protected]>

From: David Laight <[email protected]>

[ 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/[email protected]
Signed-off-by: David Laight <[email protected]>
Cc: Andy Shevchenko <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Jason A. Donenfeld <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Eliav Farber <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 include/linux/minmax.h |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- 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 >


Patches currently in stable-queue which might be from [email protected] are

queue-5.10/minmax-allow-comparisons-of-int-against-unsigned-char-short.patch
queue-5.10/minmax-add-a-few-more-min_t-max_t-users.patch
queue-5.10/minmax-improve-macro-expansion-and-type-checking.patch
queue-5.10/minmax-fix-indentation-of-__cmp_once-and-__clamp_once.patch
queue-5.10/minmax.h-simplify-the-variants-of-clamp.patch
queue-5.10/minmax-add-in_range-macro.patch
queue-5.10/minmax.h-move-all-the-clamp-definitions-after-the-min-max-ones.patch
queue-5.10/minmax-allow-min-max-clamp-if-the-arguments-have-the-same-signedness.patch
queue-5.10/minmax-don-t-use-max-in-situations-that-want-a-c-constant-expression.patch
queue-5.10/minmax.h-remove-some-defines-that-are-only-expanded-once.patch
queue-5.10/minmax.h-use-build_bug_on_msg-for-the-lo-hi-test-in-clamp.patch
queue-5.10/minmax-simplify-min-max-clamp-implementation.patch
queue-5.10/minmax-deduplicate-__unconst_integer_typeof.patch
queue-5.10/minmax-simplify-and-clarify-min_t-max_t-implementation.patch
queue-5.10/minmax.h-add-whitespace-around-operators-and-after-commas.patch
queue-5.10/minmax-sanity-check-constant-bounds-when-clamping.patch
queue-5.10/minmax-avoid-overly-complicated-constant-expressions-in-vm-code.patch
queue-5.10/minmax-make-generic-min-and-max-macros-available-everywhere.patch
queue-5.10/minmax-fix-up-min3-and-max3-too.patch
queue-5.10/minmax.h-reduce-the-define-expansion-of-min-max-and-clamp.patch
queue-5.10/minmax-fix-header-inclusions.patch
queue-5.10/minmax-introduce-min-max-_array.patch
queue-5.10/btrfs-remove-duplicated-in_range-macro.patch
queue-5.10/overflow-tracing-define-the-is_signed_type-macro-once.patch
queue-5.10/minmax-relax-check-to-allow-comparison-between-unsigned-arguments-and-signed-constants.patch
queue-5.10/minmax-clamp-more-efficiently-by-avoiding-extra-comparison.patch
queue-5.10/minmax.h-update-some-comments.patch

Reply via email to