Re: [linux-next:master 6345/7161] ipc/util.c:226:13: note: in expansion of macro 'max'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux