Re: [PATCH next v4 0/5] minmax: Relax type checks in min() and max().
From: Linus Torvalds
Date: Sat Jan 20 2024 - 16:34:08 EST
[ Going through some pending issues now that I've mostly emptied my pull queue ]
On Wed, 10 Jan 2024 at 14:58, David Laight <David.Laight@xxxxxxxxxx> wrote:
>
> The first check in __types_ok() can go, the second one (with the '+ 0')
> (added to promote char to int) includes the first one.
That turns out to not be true. An expression like
min(u8, unsigned int)
is fine because the underlying types are compatible.
But the promotion to 'int' makes the first argument be a signed
integer, and is no longer compatible with the second argument.
Linus