[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202201191557.OISJHNMi-lkp@intel.com>
Date: Wed, 19 Jan 2022 15:20:31 +0800
From: kernel test robot <lkp@...el.com>
To: Chuanhong Guo <gch981213@...il.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Ilya Lipnitskiy <ilya.lipnitskiy@...il.com>
Subject: arch/mips/ralink/mt7621.c:123:22: warning: '__builtin_memcmp'
reading between 1 and 4 bytes from a region of size 0
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 99613159ad749543621da8238acf1a122880144e
commit: 139c949f7f0ac0dd1c0da132675be80e6d76c65d MIPS: ralink: mt7621: add memory detection support
date: 10 months ago
config: mips-randconfig-r036-20220119 (https://download.01.org/0day-ci/archive/20220119/202201191557.OISJHNMi-lkp@intel.com/config)
compiler: mipsel-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=139c949f7f0ac0dd1c0da132675be80e6d76c65d
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 139c949f7f0ac0dd1c0da132675be80e6d76c65d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash arch/mips/ralink/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/kernel.h:10,
from arch/mips/ralink/mt7621.c:8:
arch/mips/ralink/mt7621.c: In function 'mt7621_memory_detect':
>> arch/mips/ralink/mt7621.c:123:22: warning: '__builtin_memcmp' reading between 1 and 4 bytes from a region of size 0 [-Wstringop-overread]
123 | if (!__builtin_memcmp(dm, dm + size, sizeof(detect_magic)))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
arch/mips/ralink/mt7621.c:123:17: note: in expansion of macro 'if'
123 | if (!__builtin_memcmp(dm, dm + size, sizeof(detect_magic)))
| ^~
arch/mips/ralink/mt7621.c:54:14: note: at offset 33554432 into source object 'detect_magic' of size 4
54 | static void *detect_magic __initdata = detect_memory_region;
| ^~~~~~~~~~~~
In file included from include/linux/kernel.h:10,
from arch/mips/ralink/mt7621.c:8:
arch/mips/ralink/mt7621.c:129:13: warning: '__builtin_memcmp' reading between 1 and 4 bytes from a region of size 0 [-Wstringop-overread]
129 | __builtin_memcmp(dm, dm + size, sizeof(detect_magic))) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:69:10: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
arch/mips/ralink/mt7621.c:127:9: note: in expansion of macro 'if'
127 | if ((size == 256 * SZ_1M) &&
| ^~
arch/mips/ralink/mt7621.c:54:14: note: at offset 268435456 into source object 'detect_magic' of size 4
54 | static void *detect_magic __initdata = detect_memory_region;
| ^~~~~~~~~~~~
{standard input}: Assembler messages:
{standard input}:127: Error: found '(', expected: ')'
{standard input}:127: Error: found '(', expected: ')'
{standard input}:127: Error: non-constant expression in ".if" statement
{standard input}:127: Error: junk at end of line, first unrecognized character is `('
{standard input}:154: Error: found '(', expected: ')'
{standard input}:154: Error: found '(', expected: ')'
{standard input}:154: Error: non-constant expression in ".if" statement
{standard input}:154: Error: junk at end of line, first unrecognized character is `('
vim +/__builtin_memcmp +123 arch/mips/ralink/mt7621.c
116
117 static void __init mt7621_memory_detect(void)
118 {
119 void *dm = &detect_magic;
120 phys_addr_t size;
121
122 for (size = 32 * SZ_1M; size < 256 * SZ_1M; size <<= 1) {
> 123 if (!__builtin_memcmp(dm, dm + size, sizeof(detect_magic)))
124 break;
125 }
126
127 if ((size == 256 * SZ_1M) &&
128 (CPHYSADDR(dm + size) < MT7621_LOWMEM_MAX_SIZE) &&
129 __builtin_memcmp(dm, dm + size, sizeof(detect_magic))) {
130 memblock_add(MT7621_LOWMEM_BASE, MT7621_LOWMEM_MAX_SIZE);
131 memblock_add(MT7621_HIGHMEM_BASE, MT7621_HIGHMEM_SIZE);
132 } else {
133 memblock_add(MT7621_LOWMEM_BASE, size);
134 }
135 }
136
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Powered by blists - more mailing lists