* Re: [PATCH] mm/mseal: use min/max in mseal_apply
[not found] ` <afe2k3jhDIXchVeE@pedro-suse>
@ 2026-05-04 12:36 ` David Laight
0 siblings, 0 replies; 4+ messages in thread
From: David Laight @ 2026-05-04 12:36 UTC (permalink / raw)
To: Pedro Falcato
Cc: Thorsten Blum, Andrew Morton, Liam R. Howlett, Lorenzo Stoakes,
Vlastimil Babka, Jann Horn, linux-mm, linux-kernel
On Sun, 3 May 2026 21:58:57 +0100
Pedro Falcato <pfalcato@suse.de> wrote:
> On Sun, May 03, 2026 at 01:59:16PM +0200, Thorsten Blum wrote:
> > Use the type-checked min()/max() macros instead of MIN()/MAX(), which
> > are supposed to be used "for obvious constants only".
>
> Gotta love these macros... FYI this isn't the only wrong usage in the kernel.
I failed to persuade Linus to include a test for __builtin_constant_p((a)|(b)) :-)
-- David
>
> >
> > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>
> Reviewed-by: Pedro Falcato <pfalcato@suse.de>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/mseal: use min/max in mseal_apply
[not found] <20260503115915.18680-3-thorsten.blum@linux.dev>
[not found] ` <afe2k3jhDIXchVeE@pedro-suse>
@ 2026-05-05 10:31 ` Lorenzo Stoakes
2026-05-08 9:37 ` David Hildenbrand (Arm)
2026-05-09 1:12 ` SeongJae Park
3 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Stoakes @ 2026-05-05 10:31 UTC (permalink / raw)
To: Thorsten Blum
Cc: Andrew Morton, Liam R. Howlett, Vlastimil Babka, Jann Horn,
Pedro Falcato, linux-mm, linux-kernel
On Sun, May 03, 2026 at 01:59:16PM +0200, Thorsten Blum wrote:
> Use the type-checked min()/max() macros instead of MIN()/MAX(), which
> are supposed to be used "for obvious constants only".
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Oops my bad :)
LGTM, so:
Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
> ---
> mm/mseal.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/mm/mseal.c b/mm/mseal.c
> index e2093ae3d25c..9781647483d1 100644
> --- a/mm/mseal.c
> +++ b/mm/mseal.c
> @@ -8,6 +8,7 @@
> */
>
> #include <linux/mempolicy.h>
> +#include <linux/minmax.h>
> #include <linux/mman.h>
> #include <linux/mm.h>
> #include <linux/mm_inline.h>
> @@ -65,8 +66,8 @@ static int mseal_apply(struct mm_struct *mm,
> prev = vma;
>
> for_each_vma_range(vmi, vma, end) {
> - const unsigned long curr_start = MAX(vma->vm_start, start);
> - const unsigned long curr_end = MIN(vma->vm_end, end);
> + const unsigned long curr_start = max(vma->vm_start, start);
> + const unsigned long curr_end = min(vma->vm_end, end);
>
> if (!vma_test(vma, VMA_SEALED_BIT)) {
> vma_flags_t vma_flags = vma->flags;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mm/mseal: use min/max in mseal_apply
[not found] <20260503115915.18680-3-thorsten.blum@linux.dev>
[not found] ` <afe2k3jhDIXchVeE@pedro-suse>
2026-05-05 10:31 ` Lorenzo Stoakes
@ 2026-05-08 9:37 ` David Hildenbrand (Arm)
2026-05-09 1:12 ` SeongJae Park
3 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand (Arm) @ 2026-05-08 9:37 UTC (permalink / raw)
To: Thorsten Blum, Andrew Morton, Liam R. Howlett, Lorenzo Stoakes,
Vlastimil Babka, Jann Horn, Pedro Falcato
Cc: linux-mm, linux-kernel
On 5/3/26 13:59, Thorsten Blum wrote:
> Use the type-checked min()/max() macros instead of MIN()/MAX(), which
> are supposed to be used "for obvious constants only".
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mm/mseal: use min/max in mseal_apply
[not found] <20260503115915.18680-3-thorsten.blum@linux.dev>
` (2 preceding siblings ...)
2026-05-08 9:37 ` David Hildenbrand (Arm)
@ 2026-05-09 1:12 ` SeongJae Park
3 siblings, 0 replies; 4+ messages in thread
From: SeongJae Park @ 2026-05-09 1:12 UTC (permalink / raw)
To: Thorsten Blum
Cc: SeongJae Park, Andrew Morton, Liam R. Howlett, Lorenzo Stoakes,
Vlastimil Babka, Jann Horn, Pedro Falcato, linux-mm, linux-kernel
On Sun, 3 May 2026 13:59:16 +0200 Thorsten Blum <thorsten.blum@linux.dev> wrote:
> Use the type-checked min()/max() macros instead of MIN()/MAX(), which
> are supposed to be used "for obvious constants only".
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-09 1:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260503115915.18680-3-thorsten.blum@linux.dev>
[not found] ` <afe2k3jhDIXchVeE@pedro-suse>
2026-05-04 12:36 ` [PATCH] mm/mseal: use min/max in mseal_apply David Laight
2026-05-05 10:31 ` Lorenzo Stoakes
2026-05-08 9:37 ` David Hildenbrand (Arm)
2026-05-09 1:12 ` SeongJae Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox