* Re: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
2026-05-28 19:03 [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask() Yury Norov
@ 2026-05-28 19:37 ` Waiman Long
2026-05-28 19:40 ` Yury Norov
2026-05-28 19:37 ` Matthew Wilcox
` (5 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Waiman Long @ 2026-05-28 19:37 UTC (permalink / raw)
To: Yury Norov, Andrew Morton, David Hildenbrand, Zi Yan,
Matthew Brost, Joshua Hahn, Rakie Kim, Byungchul Park,
Gregory Price, Ying Huang, Alistair Popple, linux-mm,
linux-kernel
Cc: Farhad Alemi, Rasmus Villemoes, cgroups
On 5/28/26 3:03 PM, Yury Norov wrote:
> Reassigning nodes relative an empty user-provided nodemask is useless,
> and triggers divide-by-zero in the function.
>
> Reported-by: Farhad Alemi <farhad.alemi@berkeley.edu>
> Link: https://lore.kernel.org/all/CA+0ovCgxbZkXa+OU8w3s84R3KNPNxxRfmsNR-udh+afQBbGNmw@mail.gmail.com/
> Signed-off-by: Yury Norov <ynorov@nvidia.com>
> ---
> mm/mempolicy.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 4e4421b22b59..cd961fa1eb33 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -370,8 +370,13 @@ static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
> static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
> const nodemask_t *rel)
> {
> + unsigned int w = nodes_weight(*rel);
> nodemask_t tmp;
> - nodes_fold(tmp, *orig, nodes_weight(*rel));
> +
> + if (w == 0)
> + return -EINVAL;
> +
> + nodes_fold(tmp, *orig, w);
> nodes_onto(*ret, tmp, *rel);
> }
>
mpol_relative_nodemask() is a void function, so this code should fail
compilation. Right?
Cheers,
Longman
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
2026-05-28 19:37 ` Waiman Long
@ 2026-05-28 19:40 ` Yury Norov
0 siblings, 0 replies; 12+ messages in thread
From: Yury Norov @ 2026-05-28 19:40 UTC (permalink / raw)
To: Waiman Long
Cc: Andrew Morton, David Hildenbrand, Zi Yan, Matthew Brost,
Joshua Hahn, Rakie Kim, Byungchul Park, Gregory Price, Ying Huang,
Alistair Popple, linux-mm, linux-kernel, Farhad Alemi,
Rasmus Villemoes, cgroups
On Thu, May 28, 2026 at 03:37:04PM -0400, Waiman Long wrote:
> On 5/28/26 3:03 PM, Yury Norov wrote:
> > Reassigning nodes relative an empty user-provided nodemask is useless,
> > and triggers divide-by-zero in the function.
> >
> > Reported-by: Farhad Alemi <farhad.alemi@berkeley.edu>
> > Link: https://lore.kernel.org/all/CA+0ovCgxbZkXa+OU8w3s84R3KNPNxxRfmsNR-udh+afQBbGNmw@mail.gmail.com/
> > Signed-off-by: Yury Norov <ynorov@nvidia.com>
> > ---
> > mm/mempolicy.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> > index 4e4421b22b59..cd961fa1eb33 100644
> > --- a/mm/mempolicy.c
> > +++ b/mm/mempolicy.c
> > @@ -370,8 +370,13 @@ static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
> > static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
> > const nodemask_t *rel)
> > {
> > + unsigned int w = nodes_weight(*rel);
> > nodemask_t tmp;
> > - nodes_fold(tmp, *orig, nodes_weight(*rel));
> > +
> > + if (w == 0)
> > + return -EINVAL;
> > +
> > + nodes_fold(tmp, *orig, w);
> > nodes_onto(*ret, tmp, *rel);
> > }
>
> mpol_relative_nodemask() is a void function, so this code should fail
> compilation. Right?
Apologize, submitted the wrong file. Will resend shortly.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
2026-05-28 19:03 [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask() Yury Norov
2026-05-28 19:37 ` Waiman Long
@ 2026-05-28 19:37 ` Matthew Wilcox
2026-05-28 19:41 ` Andrew Morton
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Matthew Wilcox @ 2026-05-28 19:37 UTC (permalink / raw)
To: Yury Norov
Cc: Andrew Morton, David Hildenbrand, Zi Yan, Matthew Brost,
Joshua Hahn, Rakie Kim, Byungchul Park, Gregory Price, Ying Huang,
Alistair Popple, linux-mm, linux-kernel, Farhad Alemi,
Waiman Long, Rasmus Villemoes, cgroups
On Thu, May 28, 2026 at 03:03:37PM -0400, Yury Norov wrote:
> static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
^^^^
> const nodemask_t *rel)
> {
> + unsigned int w = nodes_weight(*rel);
> nodemask_t tmp;
> - nodes_fold(tmp, *orig, nodes_weight(*rel));
> +
> + if (w == 0)
> + return -EINVAL;
... this doesn't even compile.
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
2026-05-28 19:03 [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask() Yury Norov
2026-05-28 19:37 ` Waiman Long
2026-05-28 19:37 ` Matthew Wilcox
@ 2026-05-28 19:41 ` Andrew Morton
2026-05-29 15:26 ` Joshua Hahn
2026-05-29 8:47 ` kernel test robot
` (3 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Andrew Morton @ 2026-05-28 19:41 UTC (permalink / raw)
To: Yury Norov
Cc: David Hildenbrand, Zi Yan, Matthew Brost, Joshua Hahn, Rakie Kim,
Byungchul Park, Gregory Price, Ying Huang, Alistair Popple,
linux-mm, linux-kernel, Farhad Alemi, Waiman Long,
Rasmus Villemoes, cgroups
On Thu, 28 May 2026 15:03:37 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> Reassigning nodes relative an empty user-provided nodemask is useless,
> and triggers divide-by-zero in the function.
>
> Reported-by: Farhad Alemi <farhad.alemi@berkeley.edu>
> Link: https://lore.kernel.org/all/CA+0ovCgxbZkXa+OU8w3s84R3KNPNxxRfmsNR-udh+afQBbGNmw@mail.gmail.com/
Thanks both.
It looks like this is very old code, so we'll be wanting a cc:stable in
this.
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -370,8 +370,13 @@ static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
> static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
> const nodemask_t *rel)
> {
> + unsigned int w = nodes_weight(*rel);
> nodemask_t tmp;
> - nodes_fold(tmp, *orig, nodes_weight(*rel));
> +
> + if (w == 0)
> + return -EINVAL;
> +
> + nodes_fold(tmp, *orig, w);
> nodes_onto(*ret, tmp, *rel);
> }
I suspect we should address this at the mpol level - it should never
have got that far. Hopefully the mempolicy maintainers can have a
think.
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
2026-05-28 19:41 ` Andrew Morton
@ 2026-05-29 15:26 ` Joshua Hahn
2026-05-29 17:47 ` Yury Norov
0 siblings, 1 reply; 12+ messages in thread
From: Joshua Hahn @ 2026-05-29 15:26 UTC (permalink / raw)
To: Andrew Morton
Cc: Yury Norov, David Hildenbrand, Zi Yan, Matthew Brost, Rakie Kim,
Byungchul Park, Gregory Price, Ying Huang, Alistair Popple,
linux-mm, linux-kernel, Farhad Alemi, Waiman Long,
Rasmus Villemoes, cgroups
On Thu, 28 May 2026 12:41:33 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:
> On Thu, 28 May 2026 15:03:37 -0400 Yury Norov <ynorov@nvidia.com> wrote:
>
> > Reassigning nodes relative an empty user-provided nodemask is useless,
> > and triggers divide-by-zero in the function.
> >
> > Reported-by: Farhad Alemi <farhad.alemi@berkeley.edu>
> > Link: https://lore.kernel.org/all/CA+0ovCgxbZkXa+OU8w3s84R3KNPNxxRfmsNR-udh+afQBbGNmw@mail.gmail.com/
>
> Thanks both.
>
> It looks like this is very old code, so we'll be wanting a cc:stable in
> this.
>
> > --- a/mm/mempolicy.c
> > +++ b/mm/mempolicy.c
> > @@ -370,8 +370,13 @@ static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
> > static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
> > const nodemask_t *rel)
> > {
> > + unsigned int w = nodes_weight(*rel);
> > nodemask_t tmp;
> > - nodes_fold(tmp, *orig, nodes_weight(*rel));
> > +
> > + if (w == 0)
> > + return -EINVAL;
> > +
> > + nodes_fold(tmp, *orig, w);
> > nodes_onto(*ret, tmp, *rel);
> > }
>
> I suspect we should address this at the mpol level - it should never
> have got that far. Hopefully the mempolicy maintainers can have a
> think.
Hello Andrew, hello Yury,
I agree with Andrew here.
mpol_relative_nodemask is called from two places, the first being
mpol_rebind_nodemask which is the calling function seen in the bug report as
well.
The other place is mpol_set_nodemask, which has a helpful comment that notes:
"mpol_set_nodemask is called after mpol_new() [...snip...] mpol_new() has
already validated the nodes parameter with respect to the policy mode and
flags".
So it seems like we are missing the big if-else if-else if block from mpol_new
in other places that should in fact have it, like mpol_rebind_nodemask.
The approach proposed here of just checking whether the node weight is 0
won't work for a few cases, namely for MPOL_DEFAULT and MPOL_PREFERRED where
empty nodemasks are actually allowed. So what should really be done here is to
do the full policy-nodemask checking section in mpol_new and call that from
mpol_set_nodemask as well.
Thank you for taking a shot at fixing the bug report, please let me know what
you think! Have a great day : -)
Joshua
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
2026-05-29 15:26 ` Joshua Hahn
@ 2026-05-29 17:47 ` Yury Norov
2026-05-29 18:40 ` Joshua Hahn
0 siblings, 1 reply; 12+ messages in thread
From: Yury Norov @ 2026-05-29 17:47 UTC (permalink / raw)
To: Joshua Hahn
Cc: Andrew Morton, David Hildenbrand, Zi Yan, Matthew Brost,
Rakie Kim, Byungchul Park, Gregory Price, Ying Huang,
Alistair Popple, linux-mm, linux-kernel, Farhad Alemi,
Waiman Long, Rasmus Villemoes, cgroups
On Fri, May 29, 2026 at 08:26:15AM -0700, Joshua Hahn wrote:
> On Thu, 28 May 2026 12:41:33 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Thu, 28 May 2026 15:03:37 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> >
> > > Reassigning nodes relative an empty user-provided nodemask is useless,
> > > and triggers divide-by-zero in the function.
> > >
> > > Reported-by: Farhad Alemi <farhad.alemi@berkeley.edu>
> > > Link: https://lore.kernel.org/all/CA+0ovCgxbZkXa+OU8w3s84R3KNPNxxRfmsNR-udh+afQBbGNmw@mail.gmail.com/
> >
> > Thanks both.
> >
> > It looks like this is very old code, so we'll be wanting a cc:stable in
> > this.
> >
> > > --- a/mm/mempolicy.c
> > > +++ b/mm/mempolicy.c
> > > @@ -370,8 +370,13 @@ static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
> > > static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
> > > const nodemask_t *rel)
> > > {
> > > + unsigned int w = nodes_weight(*rel);
> > > nodemask_t tmp;
> > > - nodes_fold(tmp, *orig, nodes_weight(*rel));
> > > +
> > > + if (w == 0)
> > > + return -EINVAL;
> > > +
> > > + nodes_fold(tmp, *orig, w);
> > > nodes_onto(*ret, tmp, *rel);
> > > }
> >
> > I suspect we should address this at the mpol level - it should never
> > have got that far. Hopefully the mempolicy maintainers can have a
> > think.
>
> Hello Andrew, hello Yury,
>
> I agree with Andrew here.
> mpol_relative_nodemask is called from two places, the first being
> mpol_rebind_nodemask which is the calling function seen in the bug report as
> well.
>
> The other place is mpol_set_nodemask, which has a helpful comment that notes:
> "mpol_set_nodemask is called after mpol_new() [...snip...] mpol_new() has
> already validated the nodes parameter with respect to the policy mode and
> flags".
>
> So it seems like we are missing the big if-else if-else if block from mpol_new
> in other places that should in fact have it, like mpol_rebind_nodemask.
>
> The approach proposed here of just checking whether the node weight is 0
> won't work for a few cases, namely for MPOL_DEFAULT and MPOL_PREFERRED where
> empty nodemasks are actually allowed. So what should really be done here is to
> do the full policy-nodemask checking section in mpol_new and call that from
> mpol_set_nodemask as well.
>
> Thank you for taking a shot at fixing the bug report, please let me know what
> you think! Have a great day : -)
Hi Joshua.
Indeed, quick and dirty shot.
The problem is that nodes_fold() can't work with the sz == 0. In
other words, folding to a 0-bit bitmap is an error. We don't check
that on bitmaps level because it's an internal helper, and it's a
caller's responsibility to validate the parameters.
nodes_onto(), or more specifically bitmap_onto(), is a different
story. In case of empty relmap, the function actually clears all the
bits in dst and returns.
I see 2 options to move this forward.
1. Simply disallow empty relmap in mpol_relative_nodemask(). There's
no valid cases for it, AFAIK, so the nodes_fold() limitation looks
reasonable. We can consider it as a new policy.
We've got 2 users for mpol_relative_nodemask(). In mpol_set_nodemask()
we can simply propagate the error; and in mpol_rebind_nodemask() we
can throw a warning and do nothing.
2. Follow the spirit of the nodes_onto(), and in case of empty
relmask, clean the ret mask and bail out
I'm in a favor for the 1st option, because empty relmask looks buggy
anyways.
> The approach proposed here of just checking whether the node weight is 0
> won't work for a few cases, namely for MPOL_DEFAULT and MPOL_PREFERRED where
> empty nodemasks are actually allowed.
Not sure I understand this. The mpol_relative_nodemask() is called
only if MPOL_F_RELATIVE_NODES is set. In mpol_rebind_nodemask(), if
both MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES are set, the former
wins. How would the RELATIVE mode mess with the others?
The mpol_new() code seemingly tries to disable empty nodes in case of
MPOL_DEFAILT and MPOL_PREFERRED + MPOL_F_RELATIVE_NODES, but obviously
it doesn't work very well in the rebind case.
Anyways, I'm not really deep in mempolicy domain, so please educate me if
I miss something.
Thanks,
Yury
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
2026-05-29 17:47 ` Yury Norov
@ 2026-05-29 18:40 ` Joshua Hahn
0 siblings, 0 replies; 12+ messages in thread
From: Joshua Hahn @ 2026-05-29 18:40 UTC (permalink / raw)
To: Yury Norov
Cc: Andrew Morton, David Hildenbrand, Zi Yan, Matthew Brost,
Rakie Kim, Byungchul Park, Gregory Price, Ying Huang,
Alistair Popple, linux-mm, linux-kernel, Farhad Alemi,
Waiman Long, Rasmus Villemoes, cgroups
On Fri, 29 May 2026 13:47:12 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> On Fri, May 29, 2026 at 08:26:15AM -0700, Joshua Hahn wrote:
> > On Thu, 28 May 2026 12:41:33 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > > On Thu, 28 May 2026 15:03:37 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> > >
> > > > Reassigning nodes relative an empty user-provided nodemask is useless,
> > > > and triggers divide-by-zero in the function.
> > > >
> > > > Reported-by: Farhad Alemi <farhad.alemi@berkeley.edu>
> > > > Link: https://lore.kernel.org/all/CA+0ovCgxbZkXa+OU8w3s84R3KNPNxxRfmsNR-udh+afQBbGNmw@mail.gmail.com/
> > >
> > > Thanks both.
> > >
> > > It looks like this is very old code, so we'll be wanting a cc:stable in
> > > this.
> > >
> > > > --- a/mm/mempolicy.c
> > > > +++ b/mm/mempolicy.c
> > > > @@ -370,8 +370,13 @@ static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
> > > > static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
> > > > const nodemask_t *rel)
> > > > {
> > > > + unsigned int w = nodes_weight(*rel);
> > > > nodemask_t tmp;
> > > > - nodes_fold(tmp, *orig, nodes_weight(*rel));
> > > > +
> > > > + if (w == 0)
> > > > + return -EINVAL;
> > > > +
> > > > + nodes_fold(tmp, *orig, w);
> > > > nodes_onto(*ret, tmp, *rel);
> > > > }
> > >
> > > I suspect we should address this at the mpol level - it should never
> > > have got that far. Hopefully the mempolicy maintainers can have a
> > > think.
> >
> > Hello Andrew, hello Yury,
> >
> > I agree with Andrew here.
> > mpol_relative_nodemask is called from two places, the first being
> > mpol_rebind_nodemask which is the calling function seen in the bug report as
> > well.
> >
> > The other place is mpol_set_nodemask, which has a helpful comment that notes:
> > "mpol_set_nodemask is called after mpol_new() [...snip...] mpol_new() has
> > already validated the nodes parameter with respect to the policy mode and
> > flags".
> >
> > So it seems like we are missing the big if-else if-else if block from mpol_new
> > in other places that should in fact have it, like mpol_rebind_nodemask.
> >
> > The approach proposed here of just checking whether the node weight is 0
> > won't work for a few cases, namely for MPOL_DEFAULT and MPOL_PREFERRED where
> > empty nodemasks are actually allowed. So what should really be done here is to
> > do the full policy-nodemask checking section in mpol_new and call that from
> > mpol_set_nodemask as well.
> >
> > Thank you for taking a shot at fixing the bug report, please let me know what
> > you think! Have a great day : -)
>
> Hi Joshua.
>
> Indeed, quick and dirty shot.
>
> The problem is that nodes_fold() can't work with the sz == 0. In
> other words, folding to a 0-bit bitmap is an error. We don't check
> that on bitmaps level because it's an internal helper, and it's a
> caller's responsibility to validate the parameters.
>
> nodes_onto(), or more specifically bitmap_onto(), is a different
> story. In case of empty relmap, the function actually clears all the
> bits in dst and returns.
I see, thank you for helping me understand. Yeah, we probably don't want
an empty nodemask here regardless of policy, as long as MPOL_F_RELATIVE_NODES
is set.
> I see 2 options to move this forward.
>
> 1. Simply disallow empty relmap in mpol_relative_nodemask(). There's
> no valid cases for it, AFAIK, so the nodes_fold() limitation looks
> reasonable. We can consider it as a new policy.
>
> We've got 2 users for mpol_relative_nodemask(). In mpol_set_nodemask()
> we can simply propagate the error; and in mpol_rebind_nodemask() we
> can throw a warning and do nothing.
I think we should never be able to reach mpol_set_nodemask with an empty
nodemask if MPOL_F_RELATIVE_NODES is set. Not sure if we need to be extra
defensive here.
For mpol_rebind_nodemask I think we should actually do some more checks,
I think we should do it in mpol_rebind_policy since it gives us an opportunity
to catch other sources of failure too, like calling mpol_rebind_preferred
with an empty nodemask as well (which shouldn't be allowed for MPOL_F_{
RELATIVE, STATIC}_NODES) as far as I can tell from the checks in mpol_new.
Setting empty nodemask for mpol_rebind_preferred won't throw a div0 error
like for mpol_rebind_nodemask but we can at least throw a warning like you
suggested.
Does that make sense? This is your fix and if you would prefer to address only
the div0 case, that makes sense too, since the empty nodemask for preferred
is more of a semantic incorrectness and will not cause panics.
Entirely up to you! : -)
> 2. Follow the spirit of the nodes_onto(), and in case of empty
> relmask, clean the ret mask and bail out
>
> I'm in a favor for the 1st option, because empty relmask looks buggy
> anyways.
>
> > The approach proposed here of just checking whether the node weight is 0
> > won't work for a few cases, namely for MPOL_DEFAULT and MPOL_PREFERRED where
> > empty nodemasks are actually allowed.
>
> Not sure I understand this. The mpol_relative_nodemask() is called
> only if MPOL_F_RELATIVE_NODES is set. In mpol_rebind_nodemask(), if
> both MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES are set, the former
> wins. How would the RELATIVE mode mess with the others?
Yes, you're right, the case that MPOL_DEFAULT and MPOL_PREFERRED allows empty
nodemasks is precisely when !STATIC && !RELATIVE :p this is my bad for missing
that case completely.
> Anyways, I'm not really deep in mempolicy domain, so please educate me if
> I miss something.
Thank you, I have also learned a lot looking into this to think about what the
best solution is!
Joshua
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
2026-05-28 19:03 [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask() Yury Norov
` (2 preceding siblings ...)
2026-05-28 19:41 ` Andrew Morton
@ 2026-05-29 8:47 ` kernel test robot
2026-05-29 8:58 ` kernel test robot
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2026-05-29 8:47 UTC (permalink / raw)
To: Yury Norov, Andrew Morton, David Hildenbrand, Zi Yan,
Matthew Brost, Joshua Hahn, Rakie Kim, Byungchul Park,
Gregory Price, Ying Huang, Alistair Popple, linux-kernel
Cc: oe-kbuild-all, Linux Memory Management List, Yury Norov,
Farhad Alemi, Waiman Long, Rasmus Villemoes, cgroups
Hi Yury,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Yury-Norov/mm-don-t-allow-empty-relative-nodemask-in-mpol_relative_nodemask/20260529-030835
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20260528190337.878027-1-ynorov%40nvidia.com
patch subject: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
config: x86_64-buildonly-randconfig-003-20260529 (https://download.01.org/0day-ci/archive/20260529/202605291631.6MATSv6v-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260529/202605291631.6MATSv6v-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605291631.6MATSv6v-lkp@intel.com/
All errors (new ones prefixed by >>):
mm/mempolicy.c: In function 'mpol_relative_nodemask':
>> mm/mempolicy.c:377:24: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
377 | return -EINVAL;
| ^
mm/mempolicy.c:370:13: note: declared here
370 | static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
| ^~~~~~~~~~~~~~~~~~~~~~
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for MFD_STMFX
Depends on [n]: HAS_IOMEM [=y] && I2C [=y] && OF [=n]
Selected by [y]:
- PINCTRL_STMFX [=y] && PINCTRL [=y] && I2C [=y] && HAS_IOMEM [=y]
vim +/return +377 mm/mempolicy.c
369
370 static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
371 const nodemask_t *rel)
372 {
373 unsigned int w = nodes_weight(*rel);
374 nodemask_t tmp;
375
376 if (w == 0)
> 377 return -EINVAL;
378
379 nodes_fold(tmp, *orig, w);
380 nodes_onto(*ret, tmp, *rel);
381 }
382
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
2026-05-28 19:03 [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask() Yury Norov
` (3 preceding siblings ...)
2026-05-29 8:47 ` kernel test robot
@ 2026-05-29 8:58 ` kernel test robot
2026-05-29 12:45 ` kernel test robot
2026-05-29 12:47 ` kernel test robot
6 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2026-05-29 8:58 UTC (permalink / raw)
To: Yury Norov, Andrew Morton, David Hildenbrand, Zi Yan,
Matthew Brost, Joshua Hahn, Rakie Kim, Byungchul Park,
Gregory Price, Ying Huang, Alistair Popple, linux-kernel
Cc: llvm, oe-kbuild-all, Linux Memory Management List, Yury Norov,
Farhad Alemi, Waiman Long, Rasmus Villemoes, cgroups
Hi Yury,
kernel test robot noticed the following build warnings:
[auto build test WARNING on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Yury-Norov/mm-don-t-allow-empty-relative-nodemask-in-mpol_relative_nodemask/20260529-030835
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20260528190337.878027-1-ynorov%40nvidia.com
patch subject: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260529/202605291609.AR5UEvmT-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260529/202605291609.AR5UEvmT-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605291609.AR5UEvmT-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> mm/mempolicy.c:377:3: warning: void function 'mpol_relative_nodemask' should not return a value [-Wreturn-mismatch]
377 | return -EINVAL;
| ^ ~~~~~~~
1 warning generated.
vim +/mpol_relative_nodemask +377 mm/mempolicy.c
369
370 static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
371 const nodemask_t *rel)
372 {
373 unsigned int w = nodes_weight(*rel);
374 nodemask_t tmp;
375
376 if (w == 0)
> 377 return -EINVAL;
378
379 nodes_fold(tmp, *orig, w);
380 nodes_onto(*ret, tmp, *rel);
381 }
382
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
2026-05-28 19:03 [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask() Yury Norov
` (4 preceding siblings ...)
2026-05-29 8:58 ` kernel test robot
@ 2026-05-29 12:45 ` kernel test robot
2026-05-29 12:47 ` kernel test robot
6 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2026-05-29 12:45 UTC (permalink / raw)
To: Yury Norov, Andrew Morton, David Hildenbrand, Zi Yan,
Matthew Brost, Joshua Hahn, Rakie Kim, Byungchul Park,
Gregory Price, Ying Huang, Alistair Popple, linux-kernel
Cc: llvm, oe-kbuild-all, Linux Memory Management List, Yury Norov,
Farhad Alemi, Waiman Long, Rasmus Villemoes, cgroups
Hi Yury,
kernel test robot noticed the following build warnings:
[auto build test WARNING on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Yury-Norov/mm-don-t-allow-empty-relative-nodemask-in-mpol_relative_nodemask/20260529-030835
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20260528190337.878027-1-ynorov%40nvidia.com
patch subject: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260529/202605291432.MbAf9EG6-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260529/202605291432.MbAf9EG6-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605291432.MbAf9EG6-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> mm/mempolicy.c:377:3: warning: void function 'mpol_relative_nodemask' should not return a value [-Wreturn-mismatch]
377 | return -EINVAL;
| ^ ~~~~~~~
1 warning generated.
vim +/mpol_relative_nodemask +377 mm/mempolicy.c
369
370 static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
371 const nodemask_t *rel)
372 {
373 unsigned int w = nodes_weight(*rel);
374 nodemask_t tmp;
375
376 if (w == 0)
> 377 return -EINVAL;
378
379 nodes_fold(tmp, *orig, w);
380 nodes_onto(*ret, tmp, *rel);
381 }
382
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
2026-05-28 19:03 [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask() Yury Norov
` (5 preceding siblings ...)
2026-05-29 12:45 ` kernel test robot
@ 2026-05-29 12:47 ` kernel test robot
6 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2026-05-29 12:47 UTC (permalink / raw)
To: Yury Norov, Andrew Morton, David Hildenbrand, Zi Yan,
Matthew Brost, Joshua Hahn, Rakie Kim, Byungchul Park,
Gregory Price, Ying Huang, Alistair Popple, linux-kernel
Cc: oe-kbuild-all, Linux Memory Management List, Yury Norov,
Farhad Alemi, Waiman Long, Rasmus Villemoes, cgroups
Hi Yury,
kernel test robot noticed the following build warnings:
[auto build test WARNING on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Yury-Norov/mm-don-t-allow-empty-relative-nodemask-in-mpol_relative_nodemask/20260529-030835
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20260528190337.878027-1-ynorov%40nvidia.com
patch subject: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()
config: sparc64-randconfig-002-20260529 (https://download.01.org/0day-ci/archive/20260529/202605292049.eaIv99hr-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260529/202605292049.eaIv99hr-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605292049.eaIv99hr-lkp@intel.com/
All warnings (new ones prefixed by >>):
mm/mempolicy.c: In function 'mpol_relative_nodemask':
>> mm/mempolicy.c:377:10: warning: 'return' with a value, in function returning void
return -EINVAL;
^
mm/mempolicy.c:370:13: note: declared here
static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
^~~~~~~~~~~~~~~~~~~~~~
vim +/return +377 mm/mempolicy.c
369
370 static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
371 const nodemask_t *rel)
372 {
373 unsigned int w = nodes_weight(*rel);
374 nodemask_t tmp;
375
376 if (w == 0)
> 377 return -EINVAL;
378
379 nodes_fold(tmp, *orig, w);
380 nodes_onto(*ret, tmp, *rel);
381 }
382
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 12+ messages in thread