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

From: David Laight
Date: Wed Jul 26 2023 - 05:31:19 EST


From: kernel test robot <lkp@xxxxxxxxx>
> 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)