mm/kasan/init.c:44:8-9: WARNING: return of 0/1 in function 'kasan_p4d_table' with return type bool

From: kbuild test robot
Date: Sun Mar 03 2019 - 17:13:21 EST


Hi Andrey,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c027c7cf1577bc2333449447c6e48c93126a56b0
commit: b938fcf42739de8270e6ea41593722929c8a7dd0 kasan: rename source files to reflect the new naming scheme
date: 9 weeks ago


coccinelle warnings: (new ones prefixed by >>)

>> mm/kasan/init.c:44:8-9: WARNING: return of 0/1 in function 'kasan_p4d_table' with return type bool
>> mm/kasan/init.c:68:8-9: WARNING: return of 0/1 in function 'kasan_pmd_table' with return type bool
>> mm/kasan/init.c:56:8-9: WARNING: return of 0/1 in function 'kasan_pud_table' with return type bool

vim +/kasan_p4d_table +44 mm/kasan/init.c

69786cdb3 mm/kasan/kasan_init.c Andrey Ryabinin 2015-08-13 34
c2febafc6 mm/kasan/kasan_init.c Kirill A. Shutemov 2017-03-09 35 #if CONFIG_PGTABLE_LEVELS > 4
c65e774fb mm/kasan/kasan_init.c Kirill A. Shutemov 2018-02-14 36 p4d_t kasan_zero_p4d[MAX_PTRS_PER_P4D] __page_aligned_bss;
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 37 static inline bool kasan_p4d_table(pgd_t pgd)
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 38 {
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 39 return pgd_page(pgd) == virt_to_page(lm_alias(kasan_zero_p4d));
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 40 }
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 41 #else
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 42 static inline bool kasan_p4d_table(pgd_t pgd)
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 43 {
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 @44 return 0;
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 45 }
c2febafc6 mm/kasan/kasan_init.c Kirill A. Shutemov 2017-03-09 46 #endif
69786cdb3 mm/kasan/kasan_init.c Andrey Ryabinin 2015-08-13 47 #if CONFIG_PGTABLE_LEVELS > 3
69786cdb3 mm/kasan/kasan_init.c Andrey Ryabinin 2015-08-13 48 pud_t kasan_zero_pud[PTRS_PER_PUD] __page_aligned_bss;
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 49 static inline bool kasan_pud_table(p4d_t p4d)
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 50 {
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 51 return p4d_page(p4d) == virt_to_page(lm_alias(kasan_zero_pud));
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 52 }
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 53 #else
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 54 static inline bool kasan_pud_table(p4d_t p4d)
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 55 {
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 @56 return 0;
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 57 }
69786cdb3 mm/kasan/kasan_init.c Andrey Ryabinin 2015-08-13 58 #endif
69786cdb3 mm/kasan/kasan_init.c Andrey Ryabinin 2015-08-13 59 #if CONFIG_PGTABLE_LEVELS > 2
69786cdb3 mm/kasan/kasan_init.c Andrey Ryabinin 2015-08-13 60 pmd_t kasan_zero_pmd[PTRS_PER_PMD] __page_aligned_bss;
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 61 static inline bool kasan_pmd_table(pud_t pud)
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 62 {
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 63 return pud_page(pud) == virt_to_page(lm_alias(kasan_zero_pmd));
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 64 }
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 65 #else
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 66 static inline bool kasan_pmd_table(pud_t pud)
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 67 {
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 @68 return 0;
0207df4fa mm/kasan/kasan_init.c Andrey Ryabinin 2018-08-17 69 }
69786cdb3 mm/kasan/kasan_init.c Andrey Ryabinin 2015-08-13 70 #endif
69786cdb3 mm/kasan/kasan_init.c Andrey Ryabinin 2015-08-13 71 pte_t kasan_zero_pte[PTRS_PER_PTE] __page_aligned_bss;
69786cdb3 mm/kasan/kasan_init.c Andrey Ryabinin 2015-08-13 72

:::::: The code at line 44 was first introduced by commit
:::::: 0207df4fa1a869281ddbf72db6203dbf036b3e1a kernel/memremap, kasan: make ZONE_DEVICE with work with KASAN

:::::: TO: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

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