2023-07-25 10:52:30

by David Laight

[permalink] [raw]
Subject: [PATCH next 0/5] minmax: Relax type checks in min() and max().

The min() (etc) functions in minmax.h require that the arguments have
exactly the same types. This was probably added after an 'accident'
where a negative value got converted to a large unsigned value.

However when the type check fails, rather than look at the types and
fix the type of a variable/constant, everyone seems to jump on min_t().
In reality min_t() ought to be rare - when something unusual is being
done, not normality.
If the wrong type is picked (and it is far too easy to pick the type
of the result instead of the larger input) then significant bits can
get discarded.
Pretty much the worst example is in the derfved clamp_val(), consider:
unsigned char x = 200u;
y = clamp_val(x, 10u, 300u);

I also suspect that many of the min_t(u16, ...) are actually wrong.
For example copy_data() in printk_ringbuffer.c contains:
data_size = min_t(u16, buf_size, len);
Here buf_size is 'unsigned int' and len 'u16', pass a 64k buffer
(can you prove that doesn't happen?) and no data is returned.

The only reason that most of the min_t() are 'fine' is that pretty
much all the value in the kernel are between 0 and INT_MAX.

Patch 1 adds min_unsigned(), this uses integer promotions to convert
both arguments to 'unsigned long long'. It can be used to compare a
signed type that is known to contain a non-negative value with an
unsigned type. The compiler typically optimises it all away.
Added first so that it can be referred to in patch 2.

Patch 2 replaces the 'same type' check with a 'same signedness' one.
This makes min(unsigned_int_var, sizeof()) be ok.
The error message is also improved and will contain the expanded
form of both arguments (useful for seeing how constants are defined).

Patch 3 just fixes some whitespace.

Patch 4 allows comparisons of 'unsigned char' and 'unsigned short'
to signed types. The integer promotion rules convert them both
to 'signed int' prior to the comparison so they can never cause
a negative value be converted to a large positive one.

Patch 5 is slightly more contentious (Linus may not like it!)
effectively adds an (int) cast to all constants between 0 and MAX_INT.
This makes min(signed_int_var, sizeof()) be ok.

With all the patches applied pretty much all the min_t() could be
replaced by min(), and most of the rest by min_unsigned().
However they all need careful inspection due to code like:
sz = min_t(unsigned char, sz - 1, LIM - 1) + 1;
which converts 0 to LIM.


David Laight (5):
Add min_unsigned(a, b) and max_unsigned(a, b)
Allow min()/max()/clamp() if the arguments have the same signedness.
Fix indentation of __cmp_once() and __clamp_once()
Allow comparisons of 'int' against 'unsigned char/short'.
Relax check to allow comparison between int and small unsigned
constants.

include/linux/minmax.h | 98 ++++++++++++++++++++++++++----------------
1 file changed, 61 insertions(+), 37 deletions(-)

--
2.17.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)



2023-07-25 11:50:13

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH next 0/5] minmax: Relax type checks in min() and max().

On Tue, Jul 25, 2023 at 10:00:40AM +0000, David Laight wrote:
> The min() (etc) functions in minmax.h require that the arguments have
> exactly the same types. This was probably added after an 'accident'
> where a negative value got converted to a large unsigned value.
>
> However when the type check fails, rather than look at the types and
> fix the type of a variable/constant, everyone seems to jump on min_t().
> In reality min_t() ought to be rare - when something unusual is being
> done, not normality.
> If the wrong type is picked (and it is far too easy to pick the type
> of the result instead of the larger input) then significant bits can
> get discarded.
> Pretty much the worst example is in the derfved clamp_val(), consider:
> unsigned char x = 200u;
> y = clamp_val(x, 10u, 300u);
>
> I also suspect that many of the min_t(u16, ...) are actually wrong.
> For example copy_data() in printk_ringbuffer.c contains:
> data_size = min_t(u16, buf_size, len);
> Here buf_size is 'unsigned int' and len 'u16', pass a 64k buffer
> (can you prove that doesn't happen?) and no data is returned.
>
> The only reason that most of the min_t() are 'fine' is that pretty
> much all the value in the kernel are between 0 and INT_MAX.
>
> Patch 1 adds min_unsigned(), this uses integer promotions to convert
> both arguments to 'unsigned long long'. It can be used to compare a
> signed type that is known to contain a non-negative value with an
> unsigned type. The compiler typically optimises it all away.
> Added first so that it can be referred to in patch 2.
>
> Patch 2 replaces the 'same type' check with a 'same signedness' one.
> This makes min(unsigned_int_var, sizeof()) be ok.
> The error message is also improved and will contain the expanded
> form of both arguments (useful for seeing how constants are defined).
>
> Patch 3 just fixes some whitespace.
>
> Patch 4 allows comparisons of 'unsigned char' and 'unsigned short'
> to signed types. The integer promotion rules convert them both
> to 'signed int' prior to the comparison so they can never cause
> a negative value be converted to a large positive one.
>
> Patch 5 is slightly more contentious (Linus may not like it!)
> effectively adds an (int) cast to all constants between 0 and MAX_INT.
> This makes min(signed_int_var, sizeof()) be ok.
>
> With all the patches applied pretty much all the min_t() could be
> replaced by min(), and most of the rest by min_unsigned().
> However they all need careful inspection due to code like:
> sz = min_t(unsigned char, sz - 1, LIM - 1) + 1;
> which converts 0 to LIM.

I don't know how you made this series, but it has no thread. You need to use
--thread when forming the patch series.

--
With Best Regards,
Andy Shevchenko



2023-07-25 11:50:37

by David Laight

[permalink] [raw]
Subject: RE: [PATCH next 0/5] minmax: Relax type checks in min() and max().

> I don't know how you made this series, but it has no thread. You need to use
> --thread when forming the patch series.

I have to send the mails through outlook.
It isn't possible to add any kind of thread-id.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


2023-07-25 12:22:10

by David Laight

[permalink] [raw]
Subject: [PATCH next resend 1/5] minmax: Add min_unsigned(a, b) and max_unsigned(a, b)

These can be used when min()/max() errors a signed v unsigned
compare when the signed value is known to be non-negative.

Unlike min_t(some_unsigned_type, a, b) min_unsigned() will never
mask off high bits if an inappropriate type is selected.

Signed-off-by: David Laight <[email protected]>
---
include/linux/minmax.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/include/linux/minmax.h b/include/linux/minmax.h
index 396df1121bff..531860e9cc55 100644
--- a/include/linux/minmax.h
+++ b/include/linux/minmax.h
@@ -73,6 +73,23 @@
*/
#define max(x, y) __careful_cmp(x, y, >)

+/**
+ * min_unsigned - return minimum of two non-negative values
+ * Signed types are zero extended to match a larger unsigned type.
+ * @x: first value
+ * @y: second value
+ */
+#define min_unsigned(x, y) \
+ __careful_cmp((x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull, <)
+
+/**
+ * max_unsigned - return maximum of two non-negative values
+ * @x: first value
+ * @y: second value
+ */
+#define max_unsigned(x, y) \
+ __careful_cmp((x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull, >)
+
/**
* min3 - return minimum of three values
* @x: first value
--
2.17.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


2023-07-25 12:25:54

by David Laight

[permalink] [raw]
Subject: [PATCH next resend 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.

The type-check in min()/max() is there to stop unexpected results if a
negative value gets converted to a large unsigned value.
However it also rejects 'unsigned int' v 'unsigned long' compares
which are common and never problematc.

Replace the 'same type' check with a 'same signedness' check.

The new test isn't itself a compile time error, so use static_assert()
to report the error and give a meaningful error message.

Due to the way builtin_choose_expr() works detecting the error in the
'non-constant' side (where static_assert() can be used) also detects
errors when the arguments are constant.

Signed-off-by: David Laight <[email protected]>
---

resend as response to 0/5

include/linux/minmax.h | 61 +++++++++++++++++++-----------------------
1 file changed, 28 insertions(+), 33 deletions(-)

diff --git a/include/linux/minmax.h b/include/linux/minmax.h
index 531860e9cc55..10d236ac7da6 100644
--- a/include/linux/minmax.h
+++ b/include/linux/minmax.h
@@ -9,33 +9,31 @@
*
* - avoid multiple evaluations of the arguments (so side-effects like
* "x++" happen only once) when non-constant.
- * - perform strict type-checking (to generate warnings instead of
- * nasty runtime surprises). See the "unnecessary" pointer comparison
- * in __typecheck().
+ * - perform signed v unsigned type-checking (to generate compile
+ * errors instead of nasty runtime surprises).
* - retain result as a constant expressions when called with only
* constant expressions (to avoid tripping VLA warnings in stack
* allocation usage).
*/
-#define __typecheck(x, y) \
- (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
+#define __types_ok(x, y) \
+ (is_signed_type(typeof(x)) == is_signed_type(typeof(y)))

-#define __no_side_effects(x, y) \
- (__is_constexpr(x) && __is_constexpr(y))
+#define __cmp_op_min <
+#define __cmp_op_max >

-#define __safe_cmp(x, y) \
- (__typecheck(x, y) && __no_side_effects(x, y))
+#define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))

-#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
-
-#define __cmp_once(x, y, unique_x, unique_y, op) ({ \
+#define __cmp_once(op, x, y, unique_x, unique_y) ({ \
typeof(x) unique_x = (x); \
typeof(y) unique_y = (y); \
- __cmp(unique_x, unique_y, op); })
+ static_assert(__types_ok(x, y), \
+ #op "(" #x ", " #y ") signedness error, fix types or consider " #op "_unsigned() before " #op "_t()"); \
+ __cmp(op, unique_x, unique_y); })

-#define __careful_cmp(x, y, op) \
- __builtin_choose_expr(__safe_cmp(x, y), \
- __cmp(x, y, op), \
- __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
+#define __careful_cmp(op, x, y) \
+ __builtin_choose_expr(__is_constexpr((x) - (y)), \
+ __cmp(op, x, y), \
+ __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))

#define __clamp(val, lo, hi) \
((val) >= (hi) ? (hi) : ((val) <= (lo) ? (lo) : (val)))
@@ -44,17 +42,14 @@
typeof(val) unique_val = (val); \
typeof(lo) unique_lo = (lo); \
typeof(hi) unique_hi = (hi); \
+ static_assert(!__is_constexpr((lo) > (hi)) || (lo) <= (hi), \
+ "clamp() low limit " #lo " greater than high limit " #hi); \
+ static_assert(__types_ok(val, lo), "clamp() 'lo' signedness error"); \
+ static_assert(__types_ok(val, hi), "clamp() 'hi' signedness error"); \
__clamp(unique_val, unique_lo, unique_hi); })

-#define __clamp_input_check(lo, hi) \
- (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
- __is_constexpr((lo) > (hi)), (lo) > (hi), false)))
-
#define __careful_clamp(val, lo, hi) ({ \
- __clamp_input_check(lo, hi) + \
- __builtin_choose_expr(__typecheck(val, lo) && __typecheck(val, hi) && \
- __typecheck(hi, lo) && __is_constexpr(val) && \
- __is_constexpr(lo) && __is_constexpr(hi), \
+ __builtin_choose_expr(__is_constexpr((val) - (lo) + (hi)), \
__clamp(val, lo, hi), \
__clamp_once(val, lo, hi, __UNIQUE_ID(__val), \
__UNIQUE_ID(__lo), __UNIQUE_ID(__hi))); })
@@ -64,14 +59,14 @@
* @x: first value
* @y: second value
*/
-#define min(x, y) __careful_cmp(x, y, <)
+#define min(x, y) __careful_cmp(min, x, y)

/**
* max - return maximum of two values of the same or compatible types
* @x: first value
* @y: second value
*/
-#define max(x, y) __careful_cmp(x, y, >)
+#define max(x, y) __careful_cmp(max, x, y)

/**
* min_unsigned - return minimum of two non-negative values
@@ -79,16 +74,16 @@
* @x: first value
* @y: second value
*/
-#define min_unsigned(x, y) \
- __careful_cmp((x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull, <)
+#define min_unsigned(x, y) \
+ __careful_cmp(min, (x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull)

/**
* max_unsigned - return maximum of two non-negative values
* @x: first value
* @y: second value
*/
-#define max_unsigned(x, y) \
- __careful_cmp((x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull, >)
+#define max_unsigned(x, y) \
+ __careful_cmp(max, (x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull)

/**
* min3 - return minimum of three values
@@ -140,7 +135,7 @@
* @x: first value
* @y: second value
*/
-#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
+#define min_t(type, x, y) __careful_cmp(min, (type)(x), (type)(y))

/**
* max_t - return maximum of two values, using the specified type
@@ -148,7 +143,7 @@
* @x: first value
* @y: second value
*/
-#define max_t(type, x, y) __careful_cmp((type)(x), (type)(y), >)
+#define max_t(type, x, y) __careful_cmp(max, (type)(x), (type)(y))

/**
* clamp_t - return a value clamped to a given range using a given type
--
2.17.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


2023-07-25 12:27:04

by David Laight

[permalink] [raw]
Subject: [PATCH next resend 3/5] minmax: Fix indentation of __cmp_once() and __clamp_once()

Remove the extra indentation and align continuation markers.

Signed-off-by: David Laight <[email protected]>
---

Resend as reply to 0/5

include/linux/minmax.h | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/include/linux/minmax.h b/include/linux/minmax.h
index 10d236ac7da6..179034479d5e 100644
--- a/include/linux/minmax.h
+++ b/include/linux/minmax.h
@@ -24,11 +24,11 @@
#define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))

#define __cmp_once(op, x, y, unique_x, unique_y) ({ \
- typeof(x) unique_x = (x); \
- typeof(y) unique_y = (y); \
- static_assert(__types_ok(x, y), \
- #op "(" #x ", " #y ") signedness error, fix types or consider " #op "_unsigned() before " #op "_t()"); \
- __cmp(op, unique_x, unique_y); })
+ typeof(x) unique_x = (x); \
+ typeof(y) unique_y = (y); \
+ static_assert(__types_ok(x, y), \
+ #op "(" #x ", " #y ") signedness error, fix types or consider " #op "_unsigned() before " #op "_t()"); \
+ __cmp(op, unique_x, unique_y); })

#define __careful_cmp(op, x, y) \
__builtin_choose_expr(__is_constexpr((x) - (y)), \
@@ -38,15 +38,15 @@
#define __clamp(val, lo, hi) \
((val) >= (hi) ? (hi) : ((val) <= (lo) ? (lo) : (val)))

-#define __clamp_once(val, lo, hi, unique_val, unique_lo, unique_hi) ({ \
- typeof(val) unique_val = (val); \
- typeof(lo) unique_lo = (lo); \
- typeof(hi) unique_hi = (hi); \
- static_assert(!__is_constexpr((lo) > (hi)) || (lo) <= (hi), \
- "clamp() low limit " #lo " greater than high limit " #hi); \
- static_assert(__types_ok(val, lo), "clamp() 'lo' signedness error"); \
- static_assert(__types_ok(val, hi), "clamp() 'hi' signedness error"); \
- __clamp(unique_val, unique_lo, unique_hi); })
+#define __clamp_once(val, lo, hi, unique_val, unique_lo, unique_hi) ({ \
+ typeof(val) unique_val = (val); \
+ typeof(lo) unique_lo = (lo); \
+ typeof(hi) unique_hi = (hi); \
+ static_assert(!__is_constexpr((lo) > (hi)) || (lo) <= (hi), \
+ "clamp() low limit " #lo " greater than high limit " #hi); \
+ static_assert(__types_ok(val, lo), "clamp() 'lo' signedness error"); \
+ static_assert(__types_ok(val, hi), "clamp() 'hi' signedness error"); \
+ __clamp(unique_val, unique_lo, unique_hi); })

#define __careful_clamp(val, lo, hi) ({ \
__builtin_choose_expr(__is_constexpr((val) - (lo) + (hi)), \
--
2.17.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


2023-07-25 12:27:33

by David Laight

[permalink] [raw]
Subject: [PATCH next resend 4/5] minmax: Allow comparisons of 'int' against 'unsigned char/short'.

Since 'unsigned char/short' get promoted to 'signed int' it is
safe to compare them against an 'int' value.

Signed-off-by: David Laight <[email protected]>
---

Resend as reply to 0/5

include/linux/minmax.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/minmax.h b/include/linux/minmax.h
index 179034479d5e..baffbe5c855d 100644
--- a/include/linux/minmax.h
+++ b/include/linux/minmax.h
@@ -16,7 +16,8 @@
* allocation usage).
*/
#define __types_ok(x, y) \
- (is_signed_type(typeof(x)) == is_signed_type(typeof(y)))
+ (is_signed_type(typeof(x)) == is_signed_type(typeof(y)) || \
+ is_signed_type(typeof((x) + 0)) == is_signed_type(typeof((y) + 0)))

#define __cmp_op_min <
#define __cmp_op_max >
--
2.17.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


2023-07-25 12:29:01

by David Laight

[permalink] [raw]
Subject: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.

Convert constants between 0 and INT_MAX to 'int' prior to comparisons
so that min(signed_var, 20u) and, more commonly, min(signed_var, sizeof())
are both valid.

Signed-off-by: David Laight <[email protected]>
---

Resend as reply to 0/5

include/linux/minmax.h | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/include/linux/minmax.h b/include/linux/minmax.h
index baffbe5c855d..27ebab9f21e7 100644
--- a/include/linux/minmax.h
+++ b/include/linux/minmax.h
@@ -7,17 +7,28 @@
/*
* min()/max()/clamp() macros must accomplish three things:
*
- * - avoid multiple evaluations of the arguments (so side-effects like
+ * - Avoid multiple evaluations of the arguments (so side-effects like
* "x++" happen only once) when non-constant.
- * - perform signed v unsigned type-checking (to generate compile
+ * - Perform signed v unsigned type-checking (to generate compile
* errors instead of nasty runtime surprises).
- * - retain result as a constant expressions when called with only
+ * Constants from 0 to INT_MAX are cast to (int) so can be used
+ * in comparisons with signed types.
+ * - Retain result as a constant expressions when called with only
* constant expressions (to avoid tripping VLA warnings in stack
* allocation usage).
*/
-#define __types_ok(x, y) \
- (is_signed_type(typeof(x)) == is_signed_type(typeof(y)) || \
- is_signed_type(typeof((x) + 0)) == is_signed_type(typeof((y) + 0)))
+
+#define __is_noneg_int(x) \
+ __builtin_choose_expr(!__is_constexpr(x), false, \
+ ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
+
+#define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
+
+#define __is_signed(x) is_signed_type(typeof(x))
+#define __types_ok(x, y) \
+ (__is_signed(x) == __is_signed(y) || \
+ __is_signed((x) + 0) == __is_signed((y) + 0) || \
+ __is_noneg_int(x) || __is_noneg_int(y))

#define __cmp_op_min <
#define __cmp_op_max >
@@ -25,24 +36,24 @@
#define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))

#define __cmp_once(op, x, y, unique_x, unique_y) ({ \
- typeof(x) unique_x = (x); \
- typeof(y) unique_y = (y); \
+ typeof(__int_const(x)) unique_x = (x); \
+ typeof(__int_const(y)) unique_y = (y); \
static_assert(__types_ok(x, y), \
#op "(" #x ", " #y ") signedness error, fix types or consider " #op "_unsigned() before " #op "_t()"); \
__cmp(op, unique_x, unique_y); })

#define __careful_cmp(op, x, y) \
__builtin_choose_expr(__is_constexpr((x) - (y)), \
- __cmp(op, x, y), \
+ __cmp(op, __int_const(x), __int_const(y)), \
__cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))

#define __clamp(val, lo, hi) \
((val) >= (hi) ? (hi) : ((val) <= (lo) ? (lo) : (val)))

#define __clamp_once(val, lo, hi, unique_val, unique_lo, unique_hi) ({ \
- typeof(val) unique_val = (val); \
- typeof(lo) unique_lo = (lo); \
- typeof(hi) unique_hi = (hi); \
+ typeof(__int_const(val)) unique_val = (val); \
+ typeof(__int_const(lo)) unique_lo = (lo); \
+ typeof(__int_const(hi)) unique_hi = (hi); \
static_assert(!__is_constexpr((lo) > (hi)) || (lo) <= (hi), \
"clamp() low limit " #lo " greater than high limit " #hi); \
static_assert(__types_ok(val, lo), "clamp() 'lo' signedness error"); \
--
2.17.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


2023-07-25 13:07:18

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH next resend 1/5] minmax: Add min_unsigned(a, b) and max_unsigned(a, b)

On Tue, Jul 25, 2023 at 11:48:14AM +0000, David Laight wrote:
> +#define min_unsigned(x, y) \
> + __careful_cmp((x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull, <)

What is the point of "+ 0u + 0ul + 0ull"? How is that any different
from "+ 0ull"? And why force the compiler to do a 64-bit comparison
when it could do a 32-bit comparison?


2023-07-25 13:49:45

by David Laight

[permalink] [raw]
Subject: RE: [PATCH next resend 1/5] minmax: Add min_unsigned(a, b) and max_unsigned(a, b)

From: Matthew Wilcox
> Sent: 25 July 2023 13:39
>
> On Tue, Jul 25, 2023 at 11:48:14AM +0000, David Laight wrote:
> > +#define min_unsigned(x, y) \
> > + __careful_cmp((x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull, <)
>
> What is the point of "+ 0u + 0ul + 0ull"? How is that any different
> from "+ 0ull"? And why force the compiler to do a 64-bit comparison
> when it could do a 32-bit comparison?

The "+ 0u + 0ul + 0ull" causes a signed 32bit value to be zero extended
to 64bit. This is significantly cheaper than the sign extension.
(Adding 0ull first converts a signed 32bit value to a signed
64bit one - the same as a cast.)

The compiler also then knows that the high 32bit are zero and
optimises away any associated compares.
So you get a 32bit compare (on both 32bit and 64bit) if both
arguments are 32bit.
This happens even at -O0.

It also has no effect on pointer types.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


2023-07-25 18:18:02

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH next resend 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.

Hi David,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on linus/master v6.5-rc3 next-20230725]
[cannot apply to next-20230725]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/David-Laight/minmax-Allow-min-max-clamp-if-the-arguments-have-the-same-signedness/20230725-204940
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/a09512c8526b46759669d0b879144563%40AcuMS.aculab.com
patch subject: [PATCH next resend 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
config: riscv-randconfig-r024-20230725 (https://download.01.org/0day-ci/archive/20230726/[email protected]/config)
compiler: riscv32-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230726/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from drivers/irqchip/irq-meson-gpio.c:15:
>> include/linux/irqchip.h:24:10: error: implicit declaration of function '__typecheck'; did you mean 'typecheck'? [-Werror=implicit-function-declaration]
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^~~~~~~~~~~
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-meson-gpio.c:597:1: note: in expansion of macro 'IRQCHIP_MATCH'
597 | IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init)
| ^~~~~~~~~~~~~
>> include/linux/irqchip.h:24:9: error: initializer element is not constant
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-meson-gpio.c:597:1: note: in expansion of macro 'IRQCHIP_MATCH'
597 | IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init)
| ^~~~~~~~~~~~~
include/linux/irqchip.h:24:9: note: (near initialization for 'meson_gpio_intc_irqchip_match_table[0].data')
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-meson-gpio.c:597:1: note: in expansion of macro 'IRQCHIP_MATCH'
597 | IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init)
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/irqchip.h:16,
from drivers/irqchip/irq-riscv-intc.c:14:
>> include/linux/irqchip.h:24:10: error: implicit declaration of function '__typecheck'; did you mean 'typecheck'? [-Werror=implicit-function-declaration]
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^~~~~~~~~~~
include/linux/of.h:1478:31: note: in definition of macro '_OF_DECLARE'
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
include/linux/irqchip.h:37:45: note: in expansion of macro 'typecheck_irq_init_cb'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-riscv-intc.c:164:1: note: in expansion of macro 'IRQCHIP_DECLARE'
164 | IRQCHIP_DECLARE(riscv, "riscv,cpu-intc", riscv_intc_init);
| ^~~~~~~~~~~~~~~
>> include/linux/of.h:1478:30: error: initializer element is not constant
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^
include/linux/of.h:1493:17: note: in expansion of macro '_OF_DECLARE'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
drivers/irqchip/irq-riscv-intc.c:164:1: note: in expansion of macro 'IRQCHIP_DECLARE'
164 | IRQCHIP_DECLARE(riscv, "riscv,cpu-intc", riscv_intc_init);
| ^~~~~~~~~~~~~~~
include/linux/of.h:1478:30: note: (near initialization for '__of_table_riscv.data')
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^
include/linux/of.h:1493:17: note: in expansion of macro '_OF_DECLARE'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
drivers/irqchip/irq-riscv-intc.c:164:1: note: in expansion of macro 'IRQCHIP_DECLARE'
164 | IRQCHIP_DECLARE(riscv, "riscv,cpu-intc", riscv_intc_init);
| ^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from drivers/irqchip/irq-renesas-rzg2l.c:14:
>> include/linux/irqchip.h:24:10: error: implicit declaration of function '__typecheck'; did you mean 'typecheck'? [-Werror=implicit-function-declaration]
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^~~~~~~~~~~
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-renesas-rzg2l.c:389:1: note: in expansion of macro 'IRQCHIP_MATCH'
389 | IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_init)
| ^~~~~~~~~~~~~
>> include/linux/irqchip.h:24:9: error: initializer element is not constant
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-renesas-rzg2l.c:389:1: note: in expansion of macro 'IRQCHIP_MATCH'
389 | IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_init)
| ^~~~~~~~~~~~~
include/linux/irqchip.h:24:9: note: (near initialization for 'rzg2l_irqc_irqchip_match_table[0].data')
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-renesas-rzg2l.c:389:1: note: in expansion of macro 'IRQCHIP_MATCH'
389 | IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_init)
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/irqchip.h:16,
from drivers/irqchip/irq-sifive-plic.c:11:
>> include/linux/irqchip.h:24:10: error: implicit declaration of function '__typecheck'; did you mean 'typecheck'? [-Werror=implicit-function-declaration]
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^~~~~~~~~~~
include/linux/of.h:1478:31: note: in definition of macro '_OF_DECLARE'
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
include/linux/irqchip.h:37:45: note: in expansion of macro 'typecheck_irq_init_cb'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-sifive-plic.c:571:1: note: in expansion of macro 'IRQCHIP_DECLARE'
571 | IRQCHIP_DECLARE(sifive_plic, "sifive,plic-1.0.0", plic_init);
| ^~~~~~~~~~~~~~~
>> include/linux/of.h:1478:30: error: initializer element is not constant
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^
include/linux/of.h:1493:17: note: in expansion of macro '_OF_DECLARE'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
drivers/irqchip/irq-sifive-plic.c:571:1: note: in expansion of macro 'IRQCHIP_DECLARE'
571 | IRQCHIP_DECLARE(sifive_plic, "sifive,plic-1.0.0", plic_init);
| ^~~~~~~~~~~~~~~
include/linux/of.h:1478:30: note: (near initialization for '__of_table_sifive_plic.data')
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^
include/linux/of.h:1493:17: note: in expansion of macro '_OF_DECLARE'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
drivers/irqchip/irq-sifive-plic.c:571:1: note: in expansion of macro 'IRQCHIP_DECLARE'
571 | IRQCHIP_DECLARE(sifive_plic, "sifive,plic-1.0.0", plic_init);
| ^~~~~~~~~~~~~~~
>> include/linux/of.h:1478:30: error: initializer element is not constant
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^
include/linux/of.h:1493:17: note: in expansion of macro '_OF_DECLARE'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
drivers/irqchip/irq-sifive-plic.c:572:1: note: in expansion of macro 'IRQCHIP_DECLARE'
572 | IRQCHIP_DECLARE(riscv_plic0, "riscv,plic0", plic_init); /* for legacy systems */
| ^~~~~~~~~~~~~~~
include/linux/of.h:1478:30: note: (near initialization for '__of_table_riscv_plic0.data')
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^
include/linux/of.h:1493:17: note: in expansion of macro '_OF_DECLARE'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
drivers/irqchip/irq-sifive-plic.c:572:1: note: in expansion of macro 'IRQCHIP_DECLARE'
572 | IRQCHIP_DECLARE(riscv_plic0, "riscv,plic0", plic_init); /* for legacy systems */
| ^~~~~~~~~~~~~~~
>> include/linux/of.h:1478:30: error: initializer element is not constant
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^
include/linux/of.h:1493:17: note: in expansion of macro '_OF_DECLARE'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
drivers/irqchip/irq-sifive-plic.c:580:1: note: in expansion of macro 'IRQCHIP_DECLARE'
580 | IRQCHIP_DECLARE(andestech_nceplic100, "andestech,nceplic100", plic_edge_init);
| ^~~~~~~~~~~~~~~
include/linux/of.h:1478:30: note: (near initialization for '__of_table_andestech_nceplic100.data')
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^
include/linux/of.h:1493:17: note: in expansion of macro '_OF_DECLARE'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
drivers/irqchip/irq-sifive-plic.c:580:1: note: in expansion of macro 'IRQCHIP_DECLARE'
580 | IRQCHIP_DECLARE(andestech_nceplic100, "andestech,nceplic100", plic_edge_init);
| ^~~~~~~~~~~~~~~
>> include/linux/of.h:1478:30: error: initializer element is not constant
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^
include/linux/of.h:1493:17: note: in expansion of macro '_OF_DECLARE'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
drivers/irqchip/irq-sifive-plic.c:581:1: note: in expansion of macro 'IRQCHIP_DECLARE'
581 | IRQCHIP_DECLARE(thead_c900_plic, "thead,c900-plic", plic_edge_init);
| ^~~~~~~~~~~~~~~
include/linux/of.h:1478:30: note: (near initialization for '__of_table_thead_c900_plic.data')
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^
include/linux/of.h:1493:17: note: in expansion of macro '_OF_DECLARE'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
drivers/irqchip/irq-sifive-plic.c:581:1: note: in expansion of macro 'IRQCHIP_DECLARE'
581 | IRQCHIP_DECLARE(thead_c900_plic, "thead,c900-plic", plic_edge_init);
| ^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/irqchip.h:16,
from drivers/irqchip/irq-mst-intc.c:9:
>> include/linux/irqchip.h:24:10: error: implicit declaration of function '__typecheck'; did you mean 'typecheck'? [-Werror=implicit-function-declaration]
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^~~~~~~~~~~
include/linux/of.h:1478:31: note: in definition of macro '_OF_DECLARE'
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
include/linux/irqchip.h:37:45: note: in expansion of macro 'typecheck_irq_init_cb'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-mst-intc.c:291:1: note: in expansion of macro 'IRQCHIP_DECLARE'
291 | IRQCHIP_DECLARE(mst_intc, "mstar,mst-intc", mst_intc_of_init);
| ^~~~~~~~~~~~~~~
>> include/linux/of.h:1478:30: error: initializer element is not constant
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^
include/linux/of.h:1493:17: note: in expansion of macro '_OF_DECLARE'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
drivers/irqchip/irq-mst-intc.c:291:1: note: in expansion of macro 'IRQCHIP_DECLARE'
291 | IRQCHIP_DECLARE(mst_intc, "mstar,mst-intc", mst_intc_of_init);
| ^~~~~~~~~~~~~~~
include/linux/of.h:1478:30: note: (near initialization for '__of_table_mst_intc.data')
1478 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^
include/linux/of.h:1493:17: note: in expansion of macro '_OF_DECLARE'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~
include/linux/irqchip.h:37:9: note: in expansion of macro 'OF_DECLARE_2'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~
drivers/irqchip/irq-mst-intc.c:291:1: note: in expansion of macro 'IRQCHIP_DECLARE'
291 | IRQCHIP_DECLARE(mst_intc, "mstar,mst-intc", mst_intc_of_init);
| ^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from drivers/irqchip/irq-imx-mu-msi.c:15:
>> include/linux/irqchip.h:24:10: error: implicit declaration of function '__typecheck'; did you mean 'typecheck'? [-Werror=implicit-function-declaration]
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^~~~~~~~~~~
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-imx-mu-msi.c:445:1: note: in expansion of macro 'IRQCHIP_MATCH'
445 | IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_of_init)
| ^~~~~~~~~~~~~
>> include/linux/irqchip.h:24:9: error: initializer element is not constant
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-imx-mu-msi.c:445:1: note: in expansion of macro 'IRQCHIP_MATCH'
445 | IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_of_init)
| ^~~~~~~~~~~~~
include/linux/irqchip.h:24:9: note: (near initialization for 'imx_mu_msi_irqchip_match_table[0].data')
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-imx-mu-msi.c:445:1: note: in expansion of macro 'IRQCHIP_MATCH'
445 | IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_of_init)
| ^~~~~~~~~~~~~
>> include/linux/irqchip.h:24:9: error: initializer element is not constant
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-imx-mu-msi.c:446:1: note: in expansion of macro 'IRQCHIP_MATCH'
446 | IRQCHIP_MATCH("fsl,imx6sx-mu-msi", imx_mu_imx6sx_of_init)
| ^~~~~~~~~~~~~
include/linux/irqchip.h:24:9: note: (near initialization for 'imx_mu_msi_irqchip_match_table[1].data')
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-imx-mu-msi.c:446:1: note: in expansion of macro 'IRQCHIP_MATCH'
446 | IRQCHIP_MATCH("fsl,imx6sx-mu-msi", imx_mu_imx6sx_of_init)
| ^~~~~~~~~~~~~
>> include/linux/irqchip.h:24:9: error: initializer element is not constant
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-imx-mu-msi.c:447:1: note: in expansion of macro 'IRQCHIP_MATCH'
447 | IRQCHIP_MATCH("fsl,imx8ulp-mu-msi", imx_mu_imx8ulp_of_init)
| ^~~~~~~~~~~~~
include/linux/irqchip.h:24:9: note: (near initialization for 'imx_mu_msi_irqchip_match_table[2].data')
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^
include/linux/irqchip.h:45:45: note: in expansion of macro 'typecheck_irq_init_cb'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-imx-mu-msi.c:447:1: note: in expansion of macro 'IRQCHIP_MATCH'
447 | IRQCHIP_MATCH("fsl,imx8ulp-mu-msi", imx_mu_imx8ulp_of_init)
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
..


vim +24 include/linux/irqchip.h

f1985002839af80 Marc Zyngier 2021-10-20 22
f1985002839af80 Marc Zyngier 2021-10-20 23 #define typecheck_irq_init_cb(fn) \
f1985002839af80 Marc Zyngier 2021-10-20 @24 (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
f1985002839af80 Marc Zyngier 2021-10-20 25

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2023-07-25 19:51:20

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH next resend 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.

Hi David,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on linus/master]
[cannot apply to next-20230725]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/David-Laight/minmax-Allow-min-max-clamp-if-the-arguments-have-the-same-signedness/20230725-204940
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/a09512c8526b46759669d0b879144563%40AcuMS.aculab.com
patch subject: [PATCH next resend 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
config: mips-randconfig-r016-20230725 (https://download.01.org/0day-ci/archive/20230726/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20230726/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/irqchip/irq-mips-cpu.c:288:1: error: call to undeclared function '__typecheck'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
288 | IRQCHIP_DECLARE(cpu_intc, "mti,cpu-interrupt-controller", mips_cpu_irq_of_init);
| ^
include/linux/irqchip.h:37:38: note: expanded from macro 'IRQCHIP_DECLARE'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^
include/linux/irqchip.h:24:3: note: expanded from macro 'typecheck_irq_init_cb'
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^
>> drivers/irqchip/irq-mips-cpu.c:288:1: error: initializer element is not a compile-time constant
288 | IRQCHIP_DECLARE(cpu_intc, "mti,cpu-interrupt-controller", mips_cpu_irq_of_init);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/irqchip.h:37:2: note: expanded from macro 'IRQCHIP_DECLARE'
37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/of.h:1493:3: note: expanded from macro 'OF_DECLARE_2'
1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/of.h:1481:2: note: expanded from macro '_OF_DECLARE'
1481 | _OF_DECLARE_STUB(table, name, compat, fn, fn_type)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/of.h:1470:16: note: expanded from macro '_OF_DECLARE_STUB'
1470 | .data = (fn == (fn_type)NULL) ? fn : fn }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
--
>> drivers/irqchip/irq-mchp-eic.c:275:1: error: call to undeclared function '__typecheck'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
275 | IRQCHIP_MATCH("microchip,sama7g5-eic", mchp_eic_init)
| ^
include/linux/irqchip.h:45:17: note: expanded from macro 'IRQCHIP_MATCH'
45 | .data = typecheck_irq_init_cb(fn), },
| ^
include/linux/irqchip.h:24:3: note: expanded from macro 'typecheck_irq_init_cb'
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^
>> drivers/irqchip/irq-mchp-eic.c:275:1: error: initializer element is not a compile-time constant
275 | IRQCHIP_MATCH("microchip,sama7g5-eic", mchp_eic_init)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/irqchip.h:45:17: note: expanded from macro 'IRQCHIP_MATCH'
45 | .data = typecheck_irq_init_cb(fn), },
| ^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/irqchip.h:24:2: note: expanded from macro 'typecheck_irq_init_cb'
24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.


vim +/__typecheck +288 drivers/irqchip/irq-mips-cpu.c

0916b46962cbcac arch/mips/kernel/irq_cpu.c Gabor Juhos 2013-01-31 281
afe8dc254711b72 arch/mips/kernel/irq_cpu.c Andrew Bresticker 2014-09-18 282 int __init mips_cpu_irq_of_init(struct device_node *of_node,
0f84c305351c993 arch/mips/kernel/irq_cpu.c Andrew Bresticker 2014-09-18 283 struct device_node *parent)
0f84c305351c993 arch/mips/kernel/irq_cpu.c Andrew Bresticker 2014-09-18 284 {
0f84c305351c993 arch/mips/kernel/irq_cpu.c Andrew Bresticker 2014-09-18 285 __mips_cpu_irq_init(of_node);
0916b46962cbcac arch/mips/kernel/irq_cpu.c Gabor Juhos 2013-01-31 286 return 0;
0916b46962cbcac arch/mips/kernel/irq_cpu.c Gabor Juhos 2013-01-31 287 }
892b8cf06d8a1e7 drivers/irqchip/irq-mips-cpu.c Paul Burton 2015-05-24 @288 IRQCHIP_DECLARE(cpu_intc, "mti,cpu-interrupt-controller", mips_cpu_irq_of_init);

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2023-07-25 20:23:34

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.5-rc3 next-20230725]
[cannot apply to next-20230725]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/David-Laight/minmax-Allow-min-max-clamp-if-the-arguments-have-the-same-signedness/20230725-204940
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/48c2cd0407f14859919d4fcbe526234a%40AcuMS.aculab.com
patch subject: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.
config: riscv-randconfig-r024-20230725 (https://download.01.org/0day-ci/archive/20230726/[email protected]/config)
compiler: riscv32-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230726/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from include/linux/kernel.h:27,
from include/linux/cpumask.h:10,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/mutex.h:17,
from include/linux/notifier.h:14,
from include/linux/kprobes.h:21,
from include/linux/kgdb.h:19,
from include/linux/fb.h:6,
from drivers/gpu/drm/drm_modes.c:35:
drivers/gpu/drm/drm_modes.c: In function 'drm_mode_parse_command_line_for_connector':
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:36:27: note: in definition of macro '__cmp'
36 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:25:47: note: in expansion of macro '__is_noneg_int'
25 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:47:27: note: in expansion of macro '__int_const'
47 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:36:45: note: in definition of macro '__cmp'
36 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:25:47: note: in expansion of macro '__is_noneg_int'
25 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:47:43: note: in expansion of macro '__int_const'
47 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:36:51: note: in definition of macro '__cmp'
36 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:25:47: note: in expansion of macro '__is_noneg_int'
25 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:47:27: note: in expansion of macro '__int_const'
47 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:36:57: note: in definition of macro '__cmp'
36 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:25:47: note: in expansion of macro '__is_noneg_int'
25 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:47:43: note: in expansion of macro '__int_const'
47 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:25:47: note: in expansion of macro '__is_noneg_int'
25 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:39:16: note: in expansion of macro '__int_const'
39 | typeof(__int_const(x)) unique_x = (x); \
| ^~~~~~~~~~~
include/linux/minmax.h:48:17: note: in expansion of macro '__cmp_once'
48 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:25:47: note: in expansion of macro '__is_noneg_int'
25 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:40:16: note: in expansion of macro '__int_const'
40 | typeof(__int_const(y)) unique_y = (y); \
| ^~~~~~~~~~~
include/linux/minmax.h:48:17: note: in expansion of macro '__cmp_once'
48 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
In file included from include/linux/init.h:5,
from include/linux/printk.h:6,
from include/asm-generic/bug.h:22,
from arch/riscv/include/asm/bug.h:83,
from include/linux/bug.h:5,
from arch/riscv/include/asm/cmpxchg.h:9,
from arch/riscv/include/asm/atomic.h:19,
from include/linux/atomic.h:7,
from include/linux/refcount.h:95,
from include/linux/fb.h:5:
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
include/linux/minmax.h:41:9: note: in expansion of macro 'static_assert'
41 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~~~~
include/linux/minmax.h:31:17: note: in expansion of macro '__is_noneg_int'
31 | __is_noneg_int(x) || __is_noneg_int(y))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:41:23: note: in expansion of macro '__types_ok'
41 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:48:17: note: in expansion of macro '__cmp_once'
48 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
include/linux/minmax.h:41:9: note: in expansion of macro 'static_assert'
41 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~~~~
include/linux/minmax.h:31:38: note: in expansion of macro '__is_noneg_int'
31 | __is_noneg_int(x) || __is_noneg_int(y))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:41:23: note: in expansion of macro '__types_ok'
41 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:48:17: note: in expansion of macro '__cmp_once'
48 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~


vim +23 include/linux/minmax.h

6
7 /*
8 * min()/max()/clamp() macros must accomplish three things:
9 *
10 * - Avoid multiple evaluations of the arguments (so side-effects like
11 * "x++" happen only once) when non-constant.
12 * - Perform signed v unsigned type-checking (to generate compile
13 * errors instead of nasty runtime surprises).
14 * Constants from 0 to INT_MAX are cast to (int) so can be used
15 * in comparisons with signed types.
16 * - Retain result as a constant expressions when called with only
17 * constant expressions (to avoid tripping VLA warnings in stack
18 * allocation usage).
19 */
20
21 #define __is_noneg_int(x) \
22 __builtin_choose_expr(!__is_constexpr(x), false, \
> 23 ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
24

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2023-07-26 09:53:02

by David Laight

[permalink] [raw]
Subject: RE: [PATCH next resend 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.

> From: kernel test robot <[email protected]>
> Sent: 25 July 2023 19:33
...
>
> All errors (new ones prefixed by >>):
>
> >> drivers/irqchip/irq-mips-cpu.c:288:1: error: call to undeclared function '__typecheck'; ISO C99 and
> later do not support implicit function declarations [-Wimplicit-function-declaration]
> 288 | IRQCHIP_DECLARE(cpu_intc, "mti,cpu-interrupt-controller", mips_cpu_irq_of_init);
> | ^
> include/linux/irqchip.h:37:38: note: expanded from macro 'IRQCHIP_DECLARE'
> 37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
> | ^
> include/linux/irqchip.h:24:3: note: expanded from macro 'typecheck_irq_init_cb'
> 24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
> | ^
> >> drivers/irqchip/irq-mips-cpu.c:288:1: error: initializer element is not a compile-time constant
> 288 | IRQCHIP_DECLARE(cpu_intc, "mti,cpu-interrupt-controller", mips_cpu_irq_of_init);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/irqchip.h:37:2: note: expanded from macro 'IRQCHIP_DECLARE'
> 37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/of.h:1493:3: note: expanded from macro 'OF_DECLARE_2'
> 1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/of.h:1481:2: note: expanded from macro '_OF_DECLARE'
> 1481 | _OF_DECLARE_STUB(table, name, compat, fn, fn_type)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/of.h:1470:16: note: expanded from macro '_OF_DECLARE_STUB'
> 1470 | .data = (fn == (fn_type)NULL) ? fn : fn }
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It looks like irqchip.h is using __typecheck() which is really
an internal part of the implementation of min() and max().
The patched version doesn't use it - hence the build fail.
I can re-instate it, but this all looks wrong to me.

The type of typecheck_irq_init_cb is the same as that of fn_type (although
they are defined separately).
Both headers seem to be testing the type - and it must match both.
So if the test in of.h worked the one in irqchip.h wouldn't have been added.
So I suspect it doesn't actually do anything - the RHS is NULL, the type
probably doesn't matter.

Possibly:
.data = {sizeof ((fn) == (fn_type)(fn)) ? fn : fn }
would actually generate the required compile-time error.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


2023-07-26 11:23:01

by David Laight

[permalink] [raw]
Subject: RE: [PATCH next resend 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.

From: Marc Zyngier
> Sent: 26 July 2023 10:51
>
> On Wed, 26 Jul 2023 10:19:48 +0100,
> David Laight <[email protected]> wrote:
> >
> > > From: kernel test robot <[email protected]>
> > > Sent: 25 July 2023 19:33
> > ...
> > >
> > > All errors (new ones prefixed by >>):
> > >
> > > >> drivers/irqchip/irq-mips-cpu.c:288:1: error: call to undeclared function '__typecheck'; ISO C99
> and
> > > later do not support implicit function declarations [-Wimplicit-function-declaration]
> > > 288 | IRQCHIP_DECLARE(cpu_intc, "mti,cpu-interrupt-controller", mips_cpu_irq_of_init);
> > > | ^
> > > include/linux/irqchip.h:37:38: note: expanded from macro 'IRQCHIP_DECLARE'
> > > 37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
> > > | ^
> > > include/linux/irqchip.h:24:3: note: expanded from macro 'typecheck_irq_init_cb'
> > > 24 | (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
> > > | ^
> > > >> drivers/irqchip/irq-mips-cpu.c:288:1: error: initializer element is not a compile-time constant
> > > 288 | IRQCHIP_DECLARE(cpu_intc, "mti,cpu-interrupt-controller", mips_cpu_irq_of_init);
> > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > include/linux/irqchip.h:37:2: note: expanded from macro 'IRQCHIP_DECLARE'
> > > 37 | OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
> > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > include/linux/of.h:1493:3: note: expanded from macro 'OF_DECLARE_2'
> > > 1493 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
> > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > include/linux/of.h:1481:2: note: expanded from macro '_OF_DECLARE'
> > > 1481 | _OF_DECLARE_STUB(table, name, compat, fn, fn_type)
> > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > include/linux/of.h:1470:16: note: expanded from macro '_OF_DECLARE_STUB'
> > > 1470 | .data = (fn == (fn_type)NULL) ? fn : fn }
> > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > It looks like irqchip.h is using __typecheck() which is really
> > an internal part of the implementation of min() and max().
> > The patched version doesn't use it - hence the build fail.
> > I can re-instate it, but this all looks wrong to me.
>
> Please see f1985002839a ("irqchip: Provide stronger type checking for
> IRQCHIP_MATCH/IRQCHIP_DECLARE") for the rationale.
>
> Given that this has uncovered a number of bugs, I'm not letting this
> go without an equivalent replacement.
..
>
> They are used in different contexts. See IRQCHIP_MATCH().

Ah, I was seeing the error in the expansion of IRQCHIP_DECLARE()
which is doing the type check twice.
It can just pass 'fn'.

The cast NULL check does work.
So IRQCHIP_MATCH() can use the simpler 'fn = (fn_type)NULL ? fn : fn' test
that _OF_DECLARE_STUB() uses.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


2023-07-26 11:25:31

by David Laight

[permalink] [raw]
Subject: RE: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.

From: kernel test robot <[email protected]>
> Sent: 25 July 2023 20:37
>
...
> drivers/gpu/drm/drm_modes.c: In function 'drm_mode_parse_command_line_for_connector':
> >> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
> 23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
> | ^~
...
> drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
> 2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
> | ^~~

There are a handful of annoying uses of min/max with pointers.
I'll fix this in v2 by adding a cast to the 0.
(I was expecting an error for unsigned types.)

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


2023-07-27 05:54:53

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master crng-random/master v6.5-rc3 next-20230726]
[cannot apply to next-20230725]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/David-Laight/minmax-Allow-min-max-clamp-if-the-arguments-have-the-same-signedness/20230725-204940
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/48c2cd0407f14859919d4fcbe526234a%40AcuMS.aculab.com
patch subject: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.
config: x86_64-randconfig-r071-20230725 (https://download.01.org/0day-ci/archive/20230727/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230727/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
>> mm/percpu.c:3102:24: sparse: sparse: incompatible types for operation (>=):
>> mm/percpu.c:3102:24: sparse: void *ptr
>> mm/percpu.c:3102:24: sparse: int
>> mm/percpu.c:3102:24: sparse: sparse: bad constant expression type
>> mm/percpu.c:3102:24: sparse: sparse: incompatible types for operation (>=):
>> mm/percpu.c:3102:24: sparse: void *[assigned] ptr
>> mm/percpu.c:3102:24: sparse: int
>> mm/percpu.c:3102:24: sparse: sparse: incompatible types for operation (>=):
>> mm/percpu.c:3102:24: sparse: void *base
>> mm/percpu.c:3102:24: sparse: int
>> mm/percpu.c:3102:24: sparse: sparse: incompatible types for operation (>=):
>> mm/percpu.c:3102:24: sparse: void *[assigned] ptr
>> mm/percpu.c:3102:24: sparse: int
>> mm/percpu.c:3102:24: sparse: sparse: incompatible types for operation (>=):
>> mm/percpu.c:3102:24: sparse: void *base
>> mm/percpu.c:3102:24: sparse: int
mm/percpu.c:3102:24: sparse: sparse: incompatible types for operation (<):
mm/percpu.c:3102:24: sparse: bad type __UNIQUE_ID___x458
mm/percpu.c:3102:24: sparse: bad type __UNIQUE_ID___y459
--
>> fs/ntfs3/lznt.c:157:16: sparse: sparse: incompatible types for operation (>=):
>> fs/ntfs3/lznt.c:157:16: sparse: unsigned char [usertype] *
>> fs/ntfs3/lznt.c:157:16: sparse: int
>> fs/ntfs3/lznt.c:157:16: sparse: sparse: bad constant expression type
>> fs/ntfs3/lznt.c:157:16: sparse: sparse: incompatible types for operation (>=):
>> fs/ntfs3/lznt.c:157:16: sparse: unsigned char [usertype] *
>> fs/ntfs3/lznt.c:157:16: sparse: int
>> fs/ntfs3/lznt.c:157:16: sparse: sparse: incompatible types for operation (>=):
>> fs/ntfs3/lznt.c:157:16: sparse: unsigned char [usertype] *cmpr_end
>> fs/ntfs3/lznt.c:157:16: sparse: int
>> fs/ntfs3/lznt.c:157:16: sparse: sparse: incompatible types for operation (>=):
>> fs/ntfs3/lznt.c:157:16: sparse: unsigned char [usertype] *
>> fs/ntfs3/lznt.c:157:16: sparse: int
>> fs/ntfs3/lznt.c:157:16: sparse: sparse: incompatible types for operation (>=):
>> fs/ntfs3/lznt.c:157:16: sparse: unsigned char [usertype] *cmpr_end
>> fs/ntfs3/lznt.c:157:16: sparse: int
fs/ntfs3/lznt.c:157:16: sparse: sparse: incompatible types for operation (<):
fs/ntfs3/lznt.c:157:16: sparse: bad type __UNIQUE_ID___x333
fs/ntfs3/lznt.c:157:16: sparse: bad type __UNIQUE_ID___y334

vim +3102 mm/percpu.c

3c9a024fde58b0 Tejun Heo 2010-09-09 3022
3c9a024fde58b0 Tejun Heo 2010-09-09 3023 #if defined(BUILD_EMBED_FIRST_CHUNK)
66c3a75772247c Tejun Heo 2009-03-10 3024 /**
66c3a75772247c Tejun Heo 2009-03-10 3025 * pcpu_embed_first_chunk - embed the first percpu chunk into bootmem
66c3a75772247c Tejun Heo 2009-03-10 3026 * @reserved_size: the size of reserved percpu area in bytes
4ba6ce250e406b Tejun Heo 2010-06-27 3027 * @dyn_size: minimum free size for dynamic allocation in bytes
c8826dd538602d Tejun Heo 2009-08-14 3028 * @atom_size: allocation atom size
c8826dd538602d Tejun Heo 2009-08-14 3029 * @cpu_distance_fn: callback to determine distance between cpus, optional
1ca3fb3abd2b61 Kefeng Wang 2022-01-19 3030 * @cpu_to_nd_fn: callback to convert cpu to it's node, optional
66c3a75772247c Tejun Heo 2009-03-10 3031 *
66c3a75772247c Tejun Heo 2009-03-10 3032 * This is a helper to ease setting up embedded first percpu chunk and
66c3a75772247c Tejun Heo 2009-03-10 3033 * can be called where pcpu_setup_first_chunk() is expected.
66c3a75772247c Tejun Heo 2009-03-10 3034 *
66c3a75772247c Tejun Heo 2009-03-10 3035 * If this function is used to setup the first chunk, it is allocated
23f917169ef157 Kefeng Wang 2022-01-19 3036 * by calling pcpu_fc_alloc and used as-is without being mapped into
c8826dd538602d Tejun Heo 2009-08-14 3037 * vmalloc area. Allocations are always whole multiples of @atom_size
c8826dd538602d Tejun Heo 2009-08-14 3038 * aligned to @atom_size.
c8826dd538602d Tejun Heo 2009-08-14 3039 *
c8826dd538602d Tejun Heo 2009-08-14 3040 * This enables the first chunk to piggy back on the linear physical
c8826dd538602d Tejun Heo 2009-08-14 3041 * mapping which often uses larger page size. Please note that this
c8826dd538602d Tejun Heo 2009-08-14 3042 * can result in very sparse cpu->unit mapping on NUMA machines thus
c8826dd538602d Tejun Heo 2009-08-14 3043 * requiring large vmalloc address space. Don't use this allocator if
c8826dd538602d Tejun Heo 2009-08-14 3044 * vmalloc space is not orders of magnitude larger than distances
c8826dd538602d Tejun Heo 2009-08-14 3045 * between node memory addresses (ie. 32bit NUMA machines).
66c3a75772247c Tejun Heo 2009-03-10 3046 *
4ba6ce250e406b Tejun Heo 2010-06-27 3047 * @dyn_size specifies the minimum dynamic area size.
66c3a75772247c Tejun Heo 2009-03-10 3048 *
66c3a75772247c Tejun Heo 2009-03-10 3049 * If the needed size is smaller than the minimum or specified unit
23f917169ef157 Kefeng Wang 2022-01-19 3050 * size, the leftover is returned using pcpu_fc_free.
66c3a75772247c Tejun Heo 2009-03-10 3051 *
66c3a75772247c Tejun Heo 2009-03-10 3052 * RETURNS:
fb435d5233f8b6 Tejun Heo 2009-08-14 3053 * 0 on success, -errno on failure.
66c3a75772247c Tejun Heo 2009-03-10 3054 */
4ba6ce250e406b Tejun Heo 2010-06-27 3055 int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
c8826dd538602d Tejun Heo 2009-08-14 3056 size_t atom_size,
c8826dd538602d Tejun Heo 2009-08-14 3057 pcpu_fc_cpu_distance_fn_t cpu_distance_fn,
23f917169ef157 Kefeng Wang 2022-01-19 3058 pcpu_fc_cpu_to_node_fn_t cpu_to_nd_fn)
66c3a75772247c Tejun Heo 2009-03-10 3059 {
c8826dd538602d Tejun Heo 2009-08-14 3060 void *base = (void *)ULONG_MAX;
c8826dd538602d Tejun Heo 2009-08-14 3061 void **areas = NULL;
fd1e8a1fe2b54d Tejun Heo 2009-08-14 3062 struct pcpu_alloc_info *ai;
93c76b6b2faaad zijun_hu 2016-10-05 3063 size_t size_sum, areas_size;
93c76b6b2faaad zijun_hu 2016-10-05 3064 unsigned long max_distance;
163fa23435cc9c Kefeng Wang 2019-07-03 3065 int group, i, highest_group, rc = 0;
66c3a75772247c Tejun Heo 2009-03-10 3066
c8826dd538602d Tejun Heo 2009-08-14 3067 ai = pcpu_build_alloc_info(reserved_size, dyn_size, atom_size,
c8826dd538602d Tejun Heo 2009-08-14 3068 cpu_distance_fn);
fd1e8a1fe2b54d Tejun Heo 2009-08-14 3069 if (IS_ERR(ai))
fd1e8a1fe2b54d Tejun Heo 2009-08-14 3070 return PTR_ERR(ai);
66c3a75772247c Tejun Heo 2009-03-10 3071
fd1e8a1fe2b54d Tejun Heo 2009-08-14 3072 size_sum = ai->static_size + ai->reserved_size + ai->dyn_size;
c8826dd538602d Tejun Heo 2009-08-14 3073 areas_size = PFN_ALIGN(ai->nr_groups * sizeof(void *));
fa8a7094ba1679 Tejun Heo 2009-06-22 3074
26fb3dae0a1ec7 Mike Rapoport 2019-03-11 3075 areas = memblock_alloc(areas_size, SMP_CACHE_BYTES);
c8826dd538602d Tejun Heo 2009-08-14 3076 if (!areas) {
fb435d5233f8b6 Tejun Heo 2009-08-14 3077 rc = -ENOMEM;
c8826dd538602d Tejun Heo 2009-08-14 3078 goto out_free;
fa8a7094ba1679 Tejun Heo 2009-06-22 3079 }
66c3a75772247c Tejun Heo 2009-03-10 3080
9b7396624a7b50 zijun_hu 2016-10-05 3081 /* allocate, copy and determine base address & max_distance */
9b7396624a7b50 zijun_hu 2016-10-05 3082 highest_group = 0;
c8826dd538602d Tejun Heo 2009-08-14 3083 for (group = 0; group < ai->nr_groups; group++) {
c8826dd538602d Tejun Heo 2009-08-14 3084 struct pcpu_group_info *gi = &ai->groups[group];
c8826dd538602d Tejun Heo 2009-08-14 3085 unsigned int cpu = NR_CPUS;
c8826dd538602d Tejun Heo 2009-08-14 3086 void *ptr;
c8826dd538602d Tejun Heo 2009-08-14 3087
c8826dd538602d Tejun Heo 2009-08-14 3088 for (i = 0; i < gi->nr_units && cpu == NR_CPUS; i++)
c8826dd538602d Tejun Heo 2009-08-14 3089 cpu = gi->cpu_map[i];
c8826dd538602d Tejun Heo 2009-08-14 3090 BUG_ON(cpu == NR_CPUS);
c8826dd538602d Tejun Heo 2009-08-14 3091
c8826dd538602d Tejun Heo 2009-08-14 3092 /* allocate space for the whole group */
23f917169ef157 Kefeng Wang 2022-01-19 3093 ptr = pcpu_fc_alloc(cpu, gi->nr_units * ai->unit_size, atom_size, cpu_to_nd_fn);
c8826dd538602d Tejun Heo 2009-08-14 3094 if (!ptr) {
c8826dd538602d Tejun Heo 2009-08-14 3095 rc = -ENOMEM;
c8826dd538602d Tejun Heo 2009-08-14 3096 goto out_free_areas;
c8826dd538602d Tejun Heo 2009-08-14 3097 }
f528f0b8e53d73 Catalin Marinas 2011-09-26 3098 /* kmemleak tracks the percpu allocations separately */
a317ebccaa3609 Patrick Wang 2022-07-05 3099 kmemleak_ignore_phys(__pa(ptr));
c8826dd538602d Tejun Heo 2009-08-14 3100 areas[group] = ptr;
c8826dd538602d Tejun Heo 2009-08-14 3101
c8826dd538602d Tejun Heo 2009-08-14 @3102 base = min(ptr, base);
9b7396624a7b50 zijun_hu 2016-10-05 3103 if (ptr > areas[highest_group])
9b7396624a7b50 zijun_hu 2016-10-05 3104 highest_group = group;
9b7396624a7b50 zijun_hu 2016-10-05 3105 }
9b7396624a7b50 zijun_hu 2016-10-05 3106 max_distance = areas[highest_group] - base;
9b7396624a7b50 zijun_hu 2016-10-05 3107 max_distance += ai->unit_size * ai->groups[highest_group].nr_units;
9b7396624a7b50 zijun_hu 2016-10-05 3108
9b7396624a7b50 zijun_hu 2016-10-05 3109 /* warn if maximum distance is further than 75% of vmalloc space */
9b7396624a7b50 zijun_hu 2016-10-05 3110 if (max_distance > VMALLOC_TOTAL * 3 / 4) {
9b7396624a7b50 zijun_hu 2016-10-05 3111 pr_warn("max_distance=0x%lx too large for vmalloc space 0x%lx\n",
9b7396624a7b50 zijun_hu 2016-10-05 3112 max_distance, VMALLOC_TOTAL);
9b7396624a7b50 zijun_hu 2016-10-05 3113 #ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
9b7396624a7b50 zijun_hu 2016-10-05 3114 /* and fail if we have fallback */
9b7396624a7b50 zijun_hu 2016-10-05 3115 rc = -EINVAL;
9b7396624a7b50 zijun_hu 2016-10-05 3116 goto out_free_areas;
9b7396624a7b50 zijun_hu 2016-10-05 3117 #endif
42b64281453249 Tejun Heo 2012-04-27 3118 }
42b64281453249 Tejun Heo 2012-04-27 3119
42b64281453249 Tejun Heo 2012-04-27 3120 /*
42b64281453249 Tejun Heo 2012-04-27 3121 * Copy data and free unused parts. This should happen after all
42b64281453249 Tejun Heo 2012-04-27 3122 * allocations are complete; otherwise, we may end up with
42b64281453249 Tejun Heo 2012-04-27 3123 * overlapping groups.
42b64281453249 Tejun Heo 2012-04-27 3124 */
42b64281453249 Tejun Heo 2012-04-27 3125 for (group = 0; group < ai->nr_groups; group++) {
42b64281453249 Tejun Heo 2012-04-27 3126 struct pcpu_group_info *gi = &ai->groups[group];
42b64281453249 Tejun Heo 2012-04-27 3127 void *ptr = areas[group];
66c3a75772247c Tejun Heo 2009-03-10 3128
c8826dd538602d Tejun Heo 2009-08-14 3129 for (i = 0; i < gi->nr_units; i++, ptr += ai->unit_size) {
c8826dd538602d Tejun Heo 2009-08-14 3130 if (gi->cpu_map[i] == NR_CPUS) {
c8826dd538602d Tejun Heo 2009-08-14 3131 /* unused unit, free whole */
23f917169ef157 Kefeng Wang 2022-01-19 3132 pcpu_fc_free(ptr, ai->unit_size);
c8826dd538602d Tejun Heo 2009-08-14 3133 continue;
c8826dd538602d Tejun Heo 2009-08-14 3134 }
c8826dd538602d Tejun Heo 2009-08-14 3135 /* copy and return the unused part */
fd1e8a1fe2b54d Tejun Heo 2009-08-14 3136 memcpy(ptr, __per_cpu_load, ai->static_size);
23f917169ef157 Kefeng Wang 2022-01-19 3137 pcpu_fc_free(ptr + size_sum, ai->unit_size - size_sum);
c8826dd538602d Tejun Heo 2009-08-14 3138 }
66c3a75772247c Tejun Heo 2009-03-10 3139 }
66c3a75772247c Tejun Heo 2009-03-10 3140
c8826dd538602d Tejun Heo 2009-08-14 3141 /* base address is now known, determine group base offsets */
6ea529a2037ce6 Tejun Heo 2009-09-24 3142 for (group = 0; group < ai->nr_groups; group++) {
c8826dd538602d Tejun Heo 2009-08-14 3143 ai->groups[group].base_offset = areas[group] - base;
6ea529a2037ce6 Tejun Heo 2009-09-24 3144 }
c8826dd538602d Tejun Heo 2009-08-14 3145
00206a69ee32f0 Matteo Croce 2019-03-18 3146 pr_info("Embedded %zu pages/cpu s%zu r%zu d%zu u%zu\n",
00206a69ee32f0 Matteo Croce 2019-03-18 3147 PFN_DOWN(size_sum), ai->static_size, ai->reserved_size,
fd1e8a1fe2b54d Tejun Heo 2009-08-14 3148 ai->dyn_size, ai->unit_size);
66c3a75772247c Tejun Heo 2009-03-10 3149
163fa23435cc9c Kefeng Wang 2019-07-03 3150 pcpu_setup_first_chunk(ai, base);
c8826dd538602d Tejun Heo 2009-08-14 3151 goto out_free;
c8826dd538602d Tejun Heo 2009-08-14 3152
c8826dd538602d Tejun Heo 2009-08-14 3153 out_free_areas:
c8826dd538602d Tejun Heo 2009-08-14 3154 for (group = 0; group < ai->nr_groups; group++)
f851c8d8583891 Michael Holzheu 2013-09-17 3155 if (areas[group])
23f917169ef157 Kefeng Wang 2022-01-19 3156 pcpu_fc_free(areas[group],
c8826dd538602d Tejun Heo 2009-08-14 3157 ai->groups[group].nr_units * ai->unit_size);
c8826dd538602d Tejun Heo 2009-08-14 3158 out_free:
fd1e8a1fe2b54d Tejun Heo 2009-08-14 3159 pcpu_free_alloc_info(ai);
c8826dd538602d Tejun Heo 2009-08-14 3160 if (areas)
4421cca0a3e483 Mike Rapoport 2021-11-05 3161 memblock_free(areas, areas_size);
fb435d5233f8b6 Tejun Heo 2009-08-14 3162 return rc;
fa8a7094ba1679 Tejun Heo 2009-06-22 3163 }
3c9a024fde58b0 Tejun Heo 2010-09-09 3164 #endif /* BUILD_EMBED_FIRST_CHUNK */
d4b95f80399471 Tejun Heo 2009-07-04 3165

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2023-07-28 08:02:49

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.5-rc3 next-20230727]
[cannot apply to next-20230725]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/David-Laight/minmax-Allow-min-max-clamp-if-the-arguments-have-the-same-signedness/20230725-204940
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/48c2cd0407f14859919d4fcbe526234a%40AcuMS.aculab.com
patch subject: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.
config: microblaze-randconfig-r092-20230725 (https://download.01.org/0day-ci/archive/20230728/[email protected]/config)
compiler: microblaze-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230728/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
>> crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>=):
>> crypto/skcipher.c:80:16: sparse: unsigned char [usertype] *start
>> crypto/skcipher.c:80:16: sparse: int
>> crypto/skcipher.c:80:16: sparse: sparse: bad constant expression type
>> crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>=):
>> crypto/skcipher.c:80:16: sparse: unsigned char [usertype] *start
>> crypto/skcipher.c:80:16: sparse: int
>> crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>=):
>> crypto/skcipher.c:80:16: sparse: unsigned char [usertype] *end_page
>> crypto/skcipher.c:80:16: sparse: int
>> crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>=):
>> crypto/skcipher.c:80:16: sparse: unsigned char [usertype] *start
>> crypto/skcipher.c:80:16: sparse: int
>> crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>=):
>> crypto/skcipher.c:80:16: sparse: unsigned char [usertype] *end_page
>> crypto/skcipher.c:80:16: sparse: int
crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>):
crypto/skcipher.c:80:16: sparse: bad type __UNIQUE_ID___x297
crypto/skcipher.c:80:16: sparse: bad type __UNIQUE_ID___y298
>> crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>=):
>> crypto/skcipher.c:80:16: sparse: unsigned char [usertype] *start
>> crypto/skcipher.c:80:16: sparse: int
>> crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>=):
>> crypto/skcipher.c:80:16: sparse: unsigned char [usertype] *end_page
>> crypto/skcipher.c:80:16: sparse: int
crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>):
crypto/skcipher.c:80:16: sparse: bad type __UNIQUE_ID___x297
crypto/skcipher.c:80:16: sparse: bad type __UNIQUE_ID___y298
>> crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>=):
>> crypto/skcipher.c:80:16: sparse: unsigned char [usertype] *start
>> crypto/skcipher.c:80:16: sparse: int
>> crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>=):
>> crypto/skcipher.c:80:16: sparse: unsigned char [usertype] *end_page
>> crypto/skcipher.c:80:16: sparse: int
crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>):
crypto/skcipher.c:80:16: sparse: bad type __UNIQUE_ID___x297
crypto/skcipher.c:80:16: sparse: bad type __UNIQUE_ID___y298
>> crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>=):
>> crypto/skcipher.c:80:16: sparse: unsigned char [usertype] *start
>> crypto/skcipher.c:80:16: sparse: int
>> crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>=):
>> crypto/skcipher.c:80:16: sparse: unsigned char [usertype] *end_page
>> crypto/skcipher.c:80:16: sparse: int
crypto/skcipher.c:80:16: sparse: sparse: incompatible types for operation (>):
crypto/skcipher.c:80:16: sparse: bad type __UNIQUE_ID___x297
crypto/skcipher.c:80:16: sparse: bad type __UNIQUE_ID___y298
--
drivers/gpu/drm/drm_modes.c: note: in included file (through include/drm/drm_plane.h, include/drm/drm_crtc.h):
include/drm/drm_color_mgmt.h:52:16: sparse: sparse: bad integer constant expression
include/drm/drm_color_mgmt.h:52:16: sparse: sparse: static assertion failed: "clamp() low limit (typeof(val))(0) greater than high limit (typeof(val))(max)"
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: sparse: incompatible types for operation (>=):
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: char *bpp_end_ptr
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: int
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: sparse: bad constant expression type
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: sparse: incompatible types for operation (>=):
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: char *[addressable] bpp_end_ptr
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: int
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: sparse: incompatible types for operation (>=):
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: char *[addressable] refresh_end_ptr
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: int
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: sparse: incompatible types for operation (>=):
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: char *[addressable] bpp_end_ptr
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: int
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: sparse: incompatible types for operation (>=):
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: char *[addressable] refresh_end_ptr
>> drivers/gpu/drm/drm_modes.c:2474:29: sparse: int
drivers/gpu/drm/drm_modes.c:2474:29: sparse: sparse: incompatible types for operation (>):
drivers/gpu/drm/drm_modes.c:2474:29: sparse: bad type __UNIQUE_ID___x334
drivers/gpu/drm/drm_modes.c:2474:29: sparse: bad type __UNIQUE_ID___y335
--
>> net/ceph/osdmap.c:1773:54: sparse: sparse: incompatible types for operation (>=):
>> net/ceph/osdmap.c:1773:54: sparse: void *
>> net/ceph/osdmap.c:1773:54: sparse: int
>> net/ceph/osdmap.c:1773:54: sparse: sparse: bad constant expression type
net/ceph/osdmap.c:2000:46: sparse: sparse: incompatible types for operation (>=):
net/ceph/osdmap.c:2000:46: sparse: void *
net/ceph/osdmap.c:2000:46: sparse: int
net/ceph/osdmap.c:2000:46: sparse: sparse: bad constant expression type
net/ceph/osdmap.c:2007:57: sparse: sparse: incompatible types for operation (>=):
net/ceph/osdmap.c:2007:57: sparse: void *
net/ceph/osdmap.c:2007:57: sparse: int
net/ceph/osdmap.c:2007:57: sparse: sparse: bad constant expression type
>> net/ceph/osdmap.c:1773:54: sparse: sparse: incompatible types for operation (>=):
>> net/ceph/osdmap.c:1773:54: sparse: void *
>> net/ceph/osdmap.c:1773:54: sparse: int
>> net/ceph/osdmap.c:1773:54: sparse: sparse: incompatible types for operation (>=):
>> net/ceph/osdmap.c:1773:54: sparse: void *end
>> net/ceph/osdmap.c:1773:54: sparse: int
>> net/ceph/osdmap.c:1773:54: sparse: sparse: incompatible types for operation (>=):
>> net/ceph/osdmap.c:1773:54: sparse: void *
>> net/ceph/osdmap.c:1773:54: sparse: int
>> net/ceph/osdmap.c:1773:54: sparse: sparse: incompatible types for operation (>=):
>> net/ceph/osdmap.c:1773:54: sparse: void *end
>> net/ceph/osdmap.c:1773:54: sparse: int
net/ceph/osdmap.c:1773:54: sparse: sparse: incompatible types for operation (<):
net/ceph/osdmap.c:1773:54: sparse: bad type __UNIQUE_ID___x318
net/ceph/osdmap.c:1773:54: sparse: bad type __UNIQUE_ID___y319
net/ceph/osdmap.c:2000:46: sparse: sparse: incompatible types for operation (>=):
net/ceph/osdmap.c:2000:46: sparse: void *
net/ceph/osdmap.c:2000:46: sparse: int
net/ceph/osdmap.c:2000:46: sparse: sparse: incompatible types for operation (>=):
net/ceph/osdmap.c:2000:46: sparse: void *end
net/ceph/osdmap.c:2000:46: sparse: int
net/ceph/osdmap.c:2000:46: sparse: sparse: incompatible types for operation (>=):
net/ceph/osdmap.c:2000:46: sparse: void *
net/ceph/osdmap.c:2000:46: sparse: int
net/ceph/osdmap.c:2000:46: sparse: sparse: incompatible types for operation (>=):
net/ceph/osdmap.c:2000:46: sparse: void *end
net/ceph/osdmap.c:2000:46: sparse: int
net/ceph/osdmap.c:2000:46: sparse: sparse: incompatible types for operation (<):
net/ceph/osdmap.c:2000:46: sparse: bad type __UNIQUE_ID___x322
net/ceph/osdmap.c:2000:46: sparse: bad type __UNIQUE_ID___y323
net/ceph/osdmap.c:2007:57: sparse: sparse: incompatible types for operation (>=):
net/ceph/osdmap.c:2007:57: sparse: void *
net/ceph/osdmap.c:2007:57: sparse: int
net/ceph/osdmap.c:2007:57: sparse: sparse: incompatible types for operation (>=):
net/ceph/osdmap.c:2007:57: sparse: void *end
net/ceph/osdmap.c:2007:57: sparse: int
net/ceph/osdmap.c:2007:57: sparse: sparse: incompatible types for operation (>=):
net/ceph/osdmap.c:2007:57: sparse: void *
net/ceph/osdmap.c:2007:57: sparse: int
net/ceph/osdmap.c:2007:57: sparse: sparse: incompatible types for operation (>=):
net/ceph/osdmap.c:2007:57: sparse: void *end
net/ceph/osdmap.c:2007:57: sparse: int
net/ceph/osdmap.c:2007:57: sparse: sparse: incompatible types for operation (<):
net/ceph/osdmap.c:2007:57: sparse: bad type __UNIQUE_ID___x324
net/ceph/osdmap.c:2007:57: sparse: bad type __UNIQUE_ID___y325
--
>> lib/lzo/lzo1x_compress.c:53:54: sparse: sparse: incompatible types for operation (>=):
>> lib/lzo/lzo1x_compress.c:53:54: sparse: unsigned char const *const ip_end
>> lib/lzo/lzo1x_compress.c:53:54: sparse: int
>> lib/lzo/lzo1x_compress.c:53:54: sparse: sparse: bad constant expression type
>> lib/lzo/lzo1x_compress.c:53:54: sparse: sparse: incompatible types for operation (>=):
>> lib/lzo/lzo1x_compress.c:53:54: sparse: unsigned char const *const ip_end
>> lib/lzo/lzo1x_compress.c:53:54: sparse: int
>> lib/lzo/lzo1x_compress.c:53:54: sparse: sparse: incompatible types for operation (>=):
>> lib/lzo/lzo1x_compress.c:53:54: sparse: unsigned char const *
>> lib/lzo/lzo1x_compress.c:53:54: sparse: int
>> lib/lzo/lzo1x_compress.c:53:54: sparse: sparse: incompatible types for operation (>=):
>> lib/lzo/lzo1x_compress.c:53:54: sparse: unsigned char const *const ip_end
>> lib/lzo/lzo1x_compress.c:53:54: sparse: int
>> lib/lzo/lzo1x_compress.c:53:54: sparse: sparse: incompatible types for operation (>=):
>> lib/lzo/lzo1x_compress.c:53:54: sparse: unsigned char const *
>> lib/lzo/lzo1x_compress.c:53:54: sparse: int
lib/lzo/lzo1x_compress.c:53:54: sparse: sparse: incompatible types for operation (<):
lib/lzo/lzo1x_compress.c:53:54: sparse: bad type __UNIQUE_ID___x182
lib/lzo/lzo1x_compress.c:53:54: sparse: bad type __UNIQUE_ID___y183

vim +80 crypto/skcipher.c

b286d8b1a69066 Herbert Xu 2016-11-22 72
b286d8b1a69066 Herbert Xu 2016-11-22 73 /* Get a spot of the specified length that does not straddle a page.
b286d8b1a69066 Herbert Xu 2016-11-22 74 * The caller needs to ensure that there is enough space for this operation.
b286d8b1a69066 Herbert Xu 2016-11-22 75 */
b286d8b1a69066 Herbert Xu 2016-11-22 76 static inline u8 *skcipher_get_spot(u8 *start, unsigned int len)
b286d8b1a69066 Herbert Xu 2016-11-22 77 {
b286d8b1a69066 Herbert Xu 2016-11-22 78 u8 *end_page = (u8 *)(((unsigned long)(start + len - 1)) & PAGE_MASK);
b286d8b1a69066 Herbert Xu 2016-11-22 79
b286d8b1a69066 Herbert Xu 2016-11-22 @80 return max(start, end_page);
b286d8b1a69066 Herbert Xu 2016-11-22 81 }
b286d8b1a69066 Herbert Xu 2016-11-22 82

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2023-07-28 08:57:21

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master crng-random/master v6.5-rc3 next-20230728]
[cannot apply to next-20230725]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/David-Laight/minmax-Allow-min-max-clamp-if-the-arguments-have-the-same-signedness/20230725-204940
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/48c2cd0407f14859919d4fcbe526234a%40AcuMS.aculab.com
patch subject: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.
config: xtensa-randconfig-r093-20230725 (https://download.01.org/0day-ci/archive/20230728/[email protected]/config)
compiler: xtensa-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230728/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
mm/kmemleak.c: note: in included file (through arch/xtensa/include/asm/bitops.h, include/linux/bitops.h, include/linux/kernel.h):
arch/xtensa/include/asm/processor.h:103:2: sparse: sparse: Unsupported xtensa ABI
arch/xtensa/include/asm/processor.h:133:2: sparse: sparse: Unsupported Xtensa ABI
>> mm/kmemleak.c:1429:32: sparse: sparse: incompatible types for operation (>=):
>> mm/kmemleak.c:1429:32: sparse: void *
>> mm/kmemleak.c:1429:32: sparse: int
>> mm/kmemleak.c:1429:32: sparse: sparse: bad constant expression type
>> mm/kmemleak.c:1429:32: sparse: sparse: incompatible types for operation (>=):
>> mm/kmemleak.c:1429:32: sparse: void *
>> mm/kmemleak.c:1429:32: sparse: int
>> mm/kmemleak.c:1429:32: sparse: sparse: incompatible types for operation (>=):
>> mm/kmemleak.c:1429:32: sparse: void *end
>> mm/kmemleak.c:1429:32: sparse: int
>> mm/kmemleak.c:1429:32: sparse: sparse: incompatible types for operation (>=):
>> mm/kmemleak.c:1429:32: sparse: void *
>> mm/kmemleak.c:1429:32: sparse: int
>> mm/kmemleak.c:1429:32: sparse: sparse: incompatible types for operation (>=):
>> mm/kmemleak.c:1429:32: sparse: void *end
>> mm/kmemleak.c:1429:32: sparse: int
mm/kmemleak.c:1429:32: sparse: sparse: incompatible types for operation (<):
mm/kmemleak.c:1429:32: sparse: bad type __UNIQUE_ID___x229
mm/kmemleak.c:1429:32: sparse: bad type __UNIQUE_ID___y230

vim +1429 mm/kmemleak.c

3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1396
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1397 /*
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1398 * Scan a memory block corresponding to a kmemleak_object. A condition is
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1399 * that object->use_count >= 1.
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1400 */
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1401 static void scan_object(struct kmemleak_object *object)
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1402 {
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1403 struct kmemleak_scan_area *area;
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1404 unsigned long flags;
0c24e061196c21 Patrick Wang 2022-06-11 1405 void *obj_ptr;
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1406
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1407 /*
21ae2956ce289f Uwe Kleine-K?nig 2009-10-07 1408 * Once the object->lock is acquired, the corresponding memory block
21ae2956ce289f Uwe Kleine-K?nig 2009-10-07 1409 * cannot be freed (the same lock is acquired in delete_object).
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1410 */
8c96f1bc6fc49c He Zhe 2020-01-30 1411 raw_spin_lock_irqsave(&object->lock, flags);
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1412 if (object->flags & OBJECT_NO_SCAN)
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1413 goto out;
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1414 if (!(object->flags & OBJECT_ALLOCATED))
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1415 /* already freed object */
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1416 goto out;
0c24e061196c21 Patrick Wang 2022-06-11 1417
0c24e061196c21 Patrick Wang 2022-06-11 1418 obj_ptr = object->flags & OBJECT_PHYS ?
0c24e061196c21 Patrick Wang 2022-06-11 1419 __va((phys_addr_t)object->pointer) :
0c24e061196c21 Patrick Wang 2022-06-11 1420 (void *)object->pointer;
0c24e061196c21 Patrick Wang 2022-06-11 1421
dba82d9431770e Catalin Marinas 2019-09-23 1422 if (hlist_empty(&object->area_list) ||
dba82d9431770e Catalin Marinas 2019-09-23 1423 object->flags & OBJECT_FULL_SCAN) {
0c24e061196c21 Patrick Wang 2022-06-11 1424 void *start = obj_ptr;
0c24e061196c21 Patrick Wang 2022-06-11 1425 void *end = obj_ptr + object->size;
93ada579b0eea0 Catalin Marinas 2015-06-24 1426 void *next;
af98603dad87e3 Catalin Marinas 2009-08-27 1427
93ada579b0eea0 Catalin Marinas 2015-06-24 1428 do {
93ada579b0eea0 Catalin Marinas 2015-06-24 @1429 next = min(start + MAX_SCAN_SIZE, end);
93ada579b0eea0 Catalin Marinas 2015-06-24 1430 scan_block(start, next, object);
93ada579b0eea0 Catalin Marinas 2015-06-24 1431
93ada579b0eea0 Catalin Marinas 2015-06-24 1432 start = next;
93ada579b0eea0 Catalin Marinas 2015-06-24 1433 if (start >= end)
93ada579b0eea0 Catalin Marinas 2015-06-24 1434 break;
af98603dad87e3 Catalin Marinas 2009-08-27 1435
8c96f1bc6fc49c He Zhe 2020-01-30 1436 raw_spin_unlock_irqrestore(&object->lock, flags);
af98603dad87e3 Catalin Marinas 2009-08-27 1437 cond_resched();
8c96f1bc6fc49c He Zhe 2020-01-30 1438 raw_spin_lock_irqsave(&object->lock, flags);
93ada579b0eea0 Catalin Marinas 2015-06-24 1439 } while (object->flags & OBJECT_ALLOCATED);
af98603dad87e3 Catalin Marinas 2009-08-27 1440 } else
b67bfe0d42cac5 Sasha Levin 2013-02-27 1441 hlist_for_each_entry(area, &object->area_list, node)
c017b4be3e8417 Catalin Marinas 2009-10-28 1442 scan_block((void *)area->start,
c017b4be3e8417 Catalin Marinas 2009-10-28 1443 (void *)(area->start + area->size),
93ada579b0eea0 Catalin Marinas 2015-06-24 1444 object);
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1445 out:
8c96f1bc6fc49c He Zhe 2020-01-30 1446 raw_spin_unlock_irqrestore(&object->lock, flags);
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1447 }
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1448

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki