linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 4283/4584] lib/../mm/internal.h:206:70: warning: suggest parentheses around '+' in operand of '&'
@ 2024-04-09  9:29 kernel test robot
  2024-04-09 11:21 ` Ryan Roberts
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2024-04-09  9:29 UTC (permalink / raw)
  To: Ryan Roberts; +Cc: oe-kbuild-all, Linux Memory Management List, Andrew Morton

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   a053fd3ca5d1b927a8655f239c84b0d790218fda
commit: 3317f7faabc24b500c26d02615ac75ca2786e272 [4283/4584] mm: swap: free_swap_and_cache_nr() as batched free_swap_and_cache()
config: parisc-allnoconfig (https://download.01.org/0day-ci/archive/20240409/202404091749.ScNPJ8j4-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240409/202404091749.ScNPJ8j4-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/202404091749.ScNPJ8j4-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/pgtable.h:6,
                    from include/linux/mm.h:30,
                    from include/linux/kallsyms.h:13,
                    from lib/vsprintf.c:30:
   lib/../mm/internal.h: In function 'pte_next_swp_offset':
>> lib/../mm/internal.h:206:70: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
     206 |                                                    swp_offset(entry) + 1));
         |                                                    ~~~~~~~~~~~~~~~~~~^~~
   arch/parisc/include/asm/pgtable.h:432:53: note: in definition of macro '__swp_entry_to_pte'
     432 | #define __swp_entry_to_pte(x)           ((pte_t) { (x).val })
         |                                                     ^
   lib/../mm/internal.h:205:40: note: in expansion of macro '__swp_entry'
     205 |         pte_t new = __swp_entry_to_pte(__swp_entry(swp_type(entry),
         |                                        ^~~~~~~~~~~
>> lib/../mm/internal.h:206:70: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
     206 |                                                    swp_offset(entry) + 1));
         |                                                    ~~~~~~~~~~~~~~~~~~^~~
   arch/parisc/include/asm/pgtable.h:432:53: note: in definition of macro '__swp_entry_to_pte'
     432 | #define __swp_entry_to_pte(x)           ((pte_t) { (x).val })
         |                                                     ^
   lib/../mm/internal.h:205:40: note: in expansion of macro '__swp_entry'
     205 |         pte_t new = __swp_entry_to_pte(__swp_entry(swp_type(entry),
         |                                        ^~~~~~~~~~~
   lib/vsprintf.c: In function 'va_format':
   lib/vsprintf.c:1683:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
    1683 |         buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
         |         ^~~


vim +206 lib/../mm/internal.h

   194	
   195	/**
   196	 * pte_next_swp_offset - Increment the swap entry offset field of a swap pte.
   197	 * @pte: The initial pte state; is_swap_pte(pte) must be true.
   198	 *
   199	 * Increments the swap offset, while maintaining all other fields, including
   200	 * swap type, and any swp pte bits. The resulting pte is returned.
   201	 */
   202	static inline pte_t pte_next_swp_offset(pte_t pte)
   203	{
   204		swp_entry_t entry = pte_to_swp_entry(pte);
   205		pte_t new = __swp_entry_to_pte(__swp_entry(swp_type(entry),
 > 206							   swp_offset(entry) + 1));
   207	
   208		if (pte_swp_soft_dirty(pte))
   209			new = pte_swp_mksoft_dirty(new);
   210		if (pte_swp_exclusive(pte))
   211			new = pte_swp_mkexclusive(new);
   212		if (pte_swp_uffd_wp(pte))
   213			new = pte_swp_mkuffd_wp(new);
   214	
   215		return new;
   216	}
   217	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [linux-next:master 4283/4584] lib/../mm/internal.h:206:70: warning: suggest parentheses around '+' in operand of '&'
  2024-04-09  9:29 [linux-next:master 4283/4584] lib/../mm/internal.h:206:70: warning: suggest parentheses around '+' in operand of '&' kernel test robot
@ 2024-04-09 11:21 ` Ryan Roberts
  0 siblings, 0 replies; 2+ messages in thread
From: Ryan Roberts @ 2024-04-09 11:21 UTC (permalink / raw)
  To: kernel test robot
  Cc: oe-kbuild-all, Linux Memory Management List, Andrew Morton

On 09/04/2024 10:29, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   a053fd3ca5d1b927a8655f239c84b0d790218fda
> commit: 3317f7faabc24b500c26d02615ac75ca2786e272 [4283/4584] mm: swap: free_swap_and_cache_nr() as batched free_swap_and_cache()
> config: parisc-allnoconfig (https://download.01.org/0day-ci/archive/20240409/202404091749.ScNPJ8j4-lkp@intel.com/config)
> compiler: hppa-linux-gcc (GCC) 13.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240409/202404091749.ScNPJ8j4-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/202404091749.ScNPJ8j4-lkp@intel.com/

Thanks for the report!

I've sent a fix to be squahed into the offending patch to:

https://lore.kernel.org/linux-mm/20240409111840.3173122-1-ryan.roberts@arm.com/

Thanks,
Ryan


> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from include/linux/pgtable.h:6,
>                     from include/linux/mm.h:30,
>                     from include/linux/kallsyms.h:13,
>                     from lib/vsprintf.c:30:
>    lib/../mm/internal.h: In function 'pte_next_swp_offset':
>>> lib/../mm/internal.h:206:70: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
>      206 |                                                    swp_offset(entry) + 1));
>          |                                                    ~~~~~~~~~~~~~~~~~~^~~
>    arch/parisc/include/asm/pgtable.h:432:53: note: in definition of macro '__swp_entry_to_pte'
>      432 | #define __swp_entry_to_pte(x)           ((pte_t) { (x).val })
>          |                                                     ^
>    lib/../mm/internal.h:205:40: note: in expansion of macro '__swp_entry'
>      205 |         pte_t new = __swp_entry_to_pte(__swp_entry(swp_type(entry),
>          |                                        ^~~~~~~~~~~
>>> lib/../mm/internal.h:206:70: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
>      206 |                                                    swp_offset(entry) + 1));
>          |                                                    ~~~~~~~~~~~~~~~~~~^~~
>    arch/parisc/include/asm/pgtable.h:432:53: note: in definition of macro '__swp_entry_to_pte'
>      432 | #define __swp_entry_to_pte(x)           ((pte_t) { (x).val })
>          |                                                     ^
>    lib/../mm/internal.h:205:40: note: in expansion of macro '__swp_entry'
>      205 |         pte_t new = __swp_entry_to_pte(__swp_entry(swp_type(entry),
>          |                                        ^~~~~~~~~~~
>    lib/vsprintf.c: In function 'va_format':
>    lib/vsprintf.c:1683:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
>     1683 |         buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
>          |         ^~~
> 
> 
> vim +206 lib/../mm/internal.h
> 
>    194	
>    195	/**
>    196	 * pte_next_swp_offset - Increment the swap entry offset field of a swap pte.
>    197	 * @pte: The initial pte state; is_swap_pte(pte) must be true.
>    198	 *
>    199	 * Increments the swap offset, while maintaining all other fields, including
>    200	 * swap type, and any swp pte bits. The resulting pte is returned.
>    201	 */
>    202	static inline pte_t pte_next_swp_offset(pte_t pte)
>    203	{
>    204		swp_entry_t entry = pte_to_swp_entry(pte);
>    205		pte_t new = __swp_entry_to_pte(__swp_entry(swp_type(entry),
>  > 206							   swp_offset(entry) + 1));
>    207	
>    208		if (pte_swp_soft_dirty(pte))
>    209			new = pte_swp_mksoft_dirty(new);
>    210		if (pte_swp_exclusive(pte))
>    211			new = pte_swp_mkexclusive(new);
>    212		if (pte_swp_uffd_wp(pte))
>    213			new = pte_swp_mkuffd_wp(new);
>    214	
>    215		return new;
>    216	}
>    217	
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-09 11:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09  9:29 [linux-next:master 4283/4584] lib/../mm/internal.h:206:70: warning: suggest parentheses around '+' in operand of '&' kernel test robot
2024-04-09 11:21 ` Ryan Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox