* [ammarfaizi2-block:akpm/mm/mm-unstable 63/63] mm/highmem.c:164:7: warning: Local variable 'i' shadows outer variable [shadowVariable]
@ 2022-10-09 21:26 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-10-09 21:26 UTC (permalink / raw)
To: Ira Weiny
Cc: kbuild-all, Ammar Faizi, GNU/Weeb Mailing List, linux-kernel,
Andrew Morton, Linux Memory Management List
tree: https://github.com/ammarfaizi2/linux-block akpm/mm/mm-unstable
head: 977bde1f5ffd252e0d4c270bc5c9489280686788
commit: 977bde1f5ffd252e0d4c270bc5c9489280686788 [63/63] highmem: fix kmap_to_page() for kmap_local_page() addresses
compiler: nios2-linux-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout 977bde1f5ffd252e0d4c270bc5c9489280686788
cppcheck --quiet --enable=style,performance,portability --template=gcc FILE
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
cppcheck warnings: (new ones prefixed by >>)
>> mm/highmem.c:164:7: warning: Local variable 'i' shadows outer variable [shadowVariable]
int i = PKMAP_NR(addr);
^
mm/highmem.c:159:6: note: Shadowed declaration
int i;
^
mm/highmem.c:164:7: note: Shadow variable
int i = PKMAP_NR(addr);
^
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
mm/highmem.c:759:13: warning: Uninitialized variable: pam->page [uninitvar]
if (pam->page == page) {
^
mm/highmem.c:796:13: warning: Uninitialized variable: pam->page [uninitvar]
if (pam->page == page) {
^
vim +/i +164 mm/highmem.c
3297e760776af1 Nicolas Pitre 2009-03-04 153
13f876ba77ebd5 Thomas Gleixner 2020-11-03 154 struct page *__kmap_to_page(void *vaddr)
5a178119b0fbe3 Mel Gorman 2012-07-31 155 {
977bde1f5ffd25 Ira Weiny 2022-10-05 156 unsigned long base = (unsigned long) vaddr & PAGE_MASK;
977bde1f5ffd25 Ira Weiny 2022-10-05 157 struct kmap_ctrl *kctrl = ¤t->kmap_ctrl;
5a178119b0fbe3 Mel Gorman 2012-07-31 158 unsigned long addr = (unsigned long)vaddr;
977bde1f5ffd25 Ira Weiny 2022-10-05 159 int i;
5a178119b0fbe3 Mel Gorman 2012-07-31 160
977bde1f5ffd25 Ira Weiny 2022-10-05 161 /* kmap() mappings */
977bde1f5ffd25 Ira Weiny 2022-10-05 162 if (WARN_ON_ONCE(addr >= PKMAP_ADDR(0) &&
977bde1f5ffd25 Ira Weiny 2022-10-05 163 addr < PKMAP_ADDR(LAST_PKMAP))) {
4de22c0584fb05 Joonsoo Kim 2012-12-11 @164 int i = PKMAP_NR(addr);
9727688dbf7ea9 songqiang 2021-05-04 165
5a178119b0fbe3 Mel Gorman 2012-07-31 166 return pte_page(pkmap_page_table[i]);
5a178119b0fbe3 Mel Gorman 2012-07-31 167 }
5a178119b0fbe3 Mel Gorman 2012-07-31 168
977bde1f5ffd25 Ira Weiny 2022-10-05 169 /* kmap_local_page() mappings */
977bde1f5ffd25 Ira Weiny 2022-10-05 170 if (WARN_ON_ONCE(base >= __fix_to_virt(FIX_KMAP_END) &&
977bde1f5ffd25 Ira Weiny 2022-10-05 171 base < __fix_to_virt(FIX_KMAP_BEGIN))) {
977bde1f5ffd25 Ira Weiny 2022-10-05 172 for (i = 0; i < kctrl->idx; i++) {
977bde1f5ffd25 Ira Weiny 2022-10-05 173 unsigned long base_addr;
977bde1f5ffd25 Ira Weiny 2022-10-05 174 int idx;
977bde1f5ffd25 Ira Weiny 2022-10-05 175
977bde1f5ffd25 Ira Weiny 2022-10-05 176 idx = arch_kmap_local_map_idx(i, pte_pfn(pteval));
977bde1f5ffd25 Ira Weiny 2022-10-05 177 base_addr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
977bde1f5ffd25 Ira Weiny 2022-10-05 178
977bde1f5ffd25 Ira Weiny 2022-10-05 179 if (base_addr == base)
977bde1f5ffd25 Ira Weiny 2022-10-05 180 return pte_page(kctrl->pteval[i]);
977bde1f5ffd25 Ira Weiny 2022-10-05 181 }
977bde1f5ffd25 Ira Weiny 2022-10-05 182 }
977bde1f5ffd25 Ira Weiny 2022-10-05 183
259ecb34e2cd73 Linus Walleij 2022-06-30 184 return virt_to_page(vaddr);
5a178119b0fbe3 Mel Gorman 2012-07-31 185 }
13f876ba77ebd5 Thomas Gleixner 2020-11-03 186 EXPORT_SYMBOL(__kmap_to_page);
5a178119b0fbe3 Mel Gorman 2012-07-31 187
:::::: The code at line 164 was first introduced by commit
:::::: 4de22c0584fb0566487b2cba5cdfbce346b18402 mm, highmem: use PKMAP_NR() to calculate an index of pkmap
:::::: TO: Joonsoo Kim <[email protected]>
:::::: CC: Linus Torvalds <[email protected]>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-09 21:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-09 21:26 [ammarfaizi2-block:akpm/mm/mm-unstable 63/63] mm/highmem.c:164:7: warning: Local variable 'i' shadows outer variable [shadowVariable] kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox