From: Manfred Spraul <manfred@colorfullife.com>
To: kbuild test robot <lkp@intel.com>
Cc: kbuild-all@01.org, Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>,
Waiman Long <longman@redhat.com>,
Davidlohr Bueso <dbueso@suse.de>
Subject: Re: [linux-next:master 6345/7161] ipc/util.c:226:13: note: in expansion of macro 'max'
Date: Sun, 14 Apr 2019 20:21:30 +0200 [thread overview]
Message-ID: <e9dc2a8a-6e57-c57a-df1f-678794542d09@colorfullife.com> (raw)
In-Reply-To: <201904130252.Ws2iLv7w%lkp@intel.com>
Hi,
Sorry - it seem that I forgot to retest the patch without sysctl() after
converting from direct if/else to max().
On 4/12/19 8:43 PM, kbuild test robot wrote:
> [...]
> ipc/util.c: In function 'ipc_idr_alloc':
> include/linux/kernel.h:828:29: warning: comparison of distinct pointer types lacks a cast
> (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
> ^
> include/linux/kernel.h:842:4: note: in expansion of macro '__typecheck'
> (__typecheck(x, y) && __no_side_effects(x, y))
> ^~~~~~~~~~~
> include/linux/kernel.h:852:24: note: in expansion of macro '__safe_cmp'
> __builtin_choose_expr(__safe_cmp(x, y), \
> ^~~~~~~~~~
> include/linux/kernel.h:868:19: note: in expansion of macro '__careful_cmp'
> #define max(x, y) __careful_cmp(x, y, >)
> ^~~~~~~~~~~~~
>>> ipc/util.c:226:13: note: in expansion of macro 'max'
> max_idx = max(ids->in_use*3/2, ipc_min_cycle);
> ^~~
>
> 223 if (next_id < 0) { /* !CHECKPOINT_RESTORE or next_id is unset */
> 224 int max_idx;
> 225
> > 226 max_idx = max(ids->in_use*3/2, ipc_min_cycle);
With sysctl disabled, ipc_min_cycle is RADIX_TREE_MAP_SIZE, and this is
> include/linux/radix-tree.h:#define RADIX_TREE_MAP_SIZE (1UL <<
RADIX_TREE_MAP_SHIFT)
The checker behind max() is not smart enough to notice that
RADIX_TREE_MAP_SIZE can be represented as int without an overflow.
What is the right approach?
> #define ipc_min_cycle ({ int tmp; tmp = RADIX_TREE_MAP_SIZE; tmp;})
--
Manfred
next prev parent reply other threads:[~2019-04-14 18:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 18:43 kbuild test robot
2019-04-14 18:21 ` Manfred Spraul [this message]
2019-04-15 20:57 ` Andrew Morton
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=e9dc2a8a-6e57-c57a-df1f-678794542d09@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=akpm@linux-foundation.org \
--cc=dbueso@suse.de \
--cc=kbuild-all@01.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=longman@redhat.com \
/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