Re: [PATCH] mm: migrate: handle freed page at the first place

From: kbuild test robot
Date: Tue Nov 12 2019 - 17:31:39 EST


Hi Yang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mmotm/master]
[also build test WARNING on v5.4-rc7 next-20191112]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Yang-Shi/mm-migrate-handle-freed-page-at-the-first-place/20191113-044923
base: git://git.cmpxchg.org/linux-mmotm.git master
config: x86_64-rhel-7.6-kasan (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

In file included from include/asm-generic/bug.h:5:0,
from arch/x86/include/asm/bug.h:83,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/mm.h:9,
from include/linux/migrate.h:5,
from mm/migrate.c:16:
mm/migrate.c: In function 'migrate_pages':
>> include/linux/compiler.h:188:26: warning: 'newpage' may be used uninitialized in this function [-Wmaybe-uninitialized]
case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \
^
mm/migrate.c:1170:15: note: 'newpage' was declared here
struct page *newpage;
^~~~~~~

vim +/newpage +188 include/linux/compiler.h

230fa253df6352 Christian Borntraeger 2014-11-25 181
d976441f44bc5d Andrey Ryabinin 2015-10-19 182 #define __READ_ONCE_SIZE \
d976441f44bc5d Andrey Ryabinin 2015-10-19 183 ({ \
d976441f44bc5d Andrey Ryabinin 2015-10-19 184 switch (size) { \
d976441f44bc5d Andrey Ryabinin 2015-10-19 185 case 1: *(__u8 *)res = *(volatile __u8 *)p; break; \
d976441f44bc5d Andrey Ryabinin 2015-10-19 186 case 2: *(__u16 *)res = *(volatile __u16 *)p; break; \
d976441f44bc5d Andrey Ryabinin 2015-10-19 187 case 4: *(__u32 *)res = *(volatile __u32 *)p; break; \
d976441f44bc5d Andrey Ryabinin 2015-10-19 @188 case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \
d976441f44bc5d Andrey Ryabinin 2015-10-19 189 default: \
d976441f44bc5d Andrey Ryabinin 2015-10-19 190 barrier(); \
d976441f44bc5d Andrey Ryabinin 2015-10-19 191 __builtin_memcpy((void *)res, (const void *)p, size); \
d976441f44bc5d Andrey Ryabinin 2015-10-19 192 barrier(); \
d976441f44bc5d Andrey Ryabinin 2015-10-19 193 } \
d976441f44bc5d Andrey Ryabinin 2015-10-19 194 })
d976441f44bc5d Andrey Ryabinin 2015-10-19 195

:::::: The code at line 188 was first introduced by commit
:::::: d976441f44bc5d48635d081d277aa76556ffbf8b compiler, atomics, kasan: Provide READ_ONCE_NOCHECK()

:::::: TO: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
:::::: CC: Ingo Molnar <mingo@xxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation

Attachment: .config.gz
Description: application/gzip