From: Andrew Morton <akpm@linux-foundation.org>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org,
Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH] lib/group_cpus: Fix unsigned expression compared with zero
Date: Thu, 11 Jan 2024 18:19:31 -0800 [thread overview]
Message-ID: <20240111181931.e3305d8b55858147e788a190@linux-foundation.org> (raw)
In-Reply-To: <20240112020250.48087-1-jiapeng.chong@linux.alibaba.com>
On Fri, 12 Jan 2024 10:02:50 +0800 Jiapeng Chong <jiapeng.chong@linux.alibaba.com> wrote:
> The nr_present and nr_others is defined as unsigned int type,
> if(nr_present < 0) and if(nr_others < 0 )is invalid. At the same time, the
> return value of function __group_cpus_evenly also of type int. so modified
> the types of nr_present and nr_others to int.
>
> lib/group_cpus.c:380 group_cpus_evenly() warn: unsigned 'nr_present' is never less than zero.
> lib/group_cpus.c:396 group_cpus_evenly() warn: unsigned 'nr_others' is never less than zero.
>
> ...
>
> --- a/lib/group_cpus.c
> +++ b/lib/group_cpus.c
> @@ -354,7 +354,8 @@ struct cpumask *group_cpus_evenly(unsigned int numgrps)
> cpumask_var_t *node_to_cpumask __free(free_node_to_cpumask) = alloc_node_to_cpumask();
> struct cpumask *masks __free(kfree) = kcalloc(numgrps, sizeof(*masks), GFP_KERNEL);
> cpumask_var_t npresmsk __free(free_cpumask_var);
> - unsigned int curgrp, nr_present, nr_others;
> + unsigned int curgrp;
> + int nr_present, nr_others;
>
> if (!masks || !node_to_cpumask || !alloc_cpumask_var(&npresmsk, GFP_KERNEL))
> return NULL;
Thanks.
Current mm.git (pushed 3 hours ago) has
int curgrp, nr_present, nr_others;
prev parent reply other threads:[~2024-01-12 2:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 2:02 Jiapeng Chong
2024-01-12 2:19 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240111181931.e3305d8b55858147e788a190@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=abaci@linux.alibaba.com \
--cc=jiapeng.chong@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®