GNU/Weeb Mailing List <[email protected]>
 help / color / mirror / Atom feed
* [ammarfaizi2-block:akpm/mm/mm-unstable 160/254] mm/rmap.c:1325 page_add_anon_rmap() error: uninitialized symbol 'first'.
@ 2022-11-21 10:47 Dan Carpenter
  2022-11-21 19:44 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2022-11-21 10:47 UTC (permalink / raw)
  To: oe-kbuild, Hugh Dickins
  Cc: lkp, oe-kbuild-all, Ammar Faizi, GNU/Weeb Mailing List,
	Andrew Morton, Linux Memory Management List

tree:   https://github.com/ammarfaizi2/linux-block akpm/mm/mm-unstable
head:   a8da2493d983a10242e6c9d71c6e828aafa5baf8
commit: d68dde0dc6f8b8d09357a32473db8881173b10b0 [160/254] mm,thp,rmap: subpages_mapcount of PTE-mapped subpages
config: i386-randconfig-m021
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
mm/rmap.c:1325 page_add_anon_rmap() error: uninitialized symbol 'first'.

vim +/first +1325 mm/rmap.c

9617d95e6e9ffd Nicholas Piggin    2006-01-06  1278  void page_add_anon_rmap(struct page *page,
14f9135d547060 David Hildenbrand  2022-05-09  1279  	struct vm_area_struct *vma, unsigned long address, rmap_t flags)
9617d95e6e9ffd Nicholas Piggin    2006-01-06  1280  {
5b3276bc4a2e01 Hugh Dickins       2022-11-02  1281  	struct compound_mapcounts mapcounts;
5b3276bc4a2e01 Hugh Dickins       2022-11-02  1282  	int nr = 0, nr_pmdmapped = 0;
d281ee61451835 Kirill A. Shutemov 2016-01-15  1283  	bool compound = flags & RMAP_COMPOUND;
53f9263baba69f Kirill A. Shutemov 2016-01-15  1284  	bool first;
                                                        ^^^^^^^^^^
53f9263baba69f Kirill A. Shutemov 2016-01-15  1285  
be5d0a74c62d8d Johannes Weiner    2020-06-03  1286  	if (unlikely(PageKsm(page)))
be5d0a74c62d8d Johannes Weiner    2020-06-03  1287  		lock_page_memcg(page);
be5d0a74c62d8d Johannes Weiner    2020-06-03  1288  
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1289  	if (likely(!compound /* page is mapped by PTE */)) {
84e6cb5a201a85 Hugh Dickins       2022-11-09  1290  		first = atomic_inc_and_test(&page->_mapcount);
84e6cb5a201a85 Hugh Dickins       2022-11-09  1291  		nr = first;
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1292  		if (first && PageCompound(page)) {
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1293  			struct page *head = compound_head(page);
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1294  
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1295  			lock_compound_mapcounts(head, &mapcounts);
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1296  			mapcounts.subpages_mapcount++;
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1297  			nr = !mapcounts.compound_mapcount;
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1298  			unlock_compound_mapcounts(head, &mapcounts);
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1299  		}
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1300  	} else if (PageTransHuge(page)) {
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1301  		/* That test is redundant: it's for safety or to optimize out */
84e6cb5a201a85 Hugh Dickins       2022-11-09  1302  
5b3276bc4a2e01 Hugh Dickins       2022-11-02  1303  		lock_compound_mapcounts(page, &mapcounts);
5b3276bc4a2e01 Hugh Dickins       2022-11-02  1304  		first = !mapcounts.compound_mapcount;
5b3276bc4a2e01 Hugh Dickins       2022-11-02  1305  		mapcounts.compound_mapcount++;
5b3276bc4a2e01 Hugh Dickins       2022-11-02  1306  		if (first) {
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1307  			nr_pmdmapped = thp_nr_pages(page);
d68dde0dc6f8b8 Hugh Dickins       2022-11-18  1308  			nr = nr_pmdmapped - mapcounts.subpages_mapcount;
5b3276bc4a2e01 Hugh Dickins       2022-11-02  1309  		}
5b3276bc4a2e01 Hugh Dickins       2022-11-02  1310  		unlock_compound_mapcounts(page, &mapcounts);
53f9263baba69f Kirill A. Shutemov 2016-01-15  1311  	}

No else path.

bde3d57e6cec9c Hugh Dickins       2022-11-02  1312  
6c287605fd5646 David Hildenbrand  2022-05-09  1313  	VM_BUG_ON_PAGE(!first && (flags & RMAP_EXCLUSIVE), page);
                                                                        ^^^^^
Uninitialized.


6c287605fd5646 David Hildenbrand  2022-05-09  1314  	VM_BUG_ON_PAGE(!first && PageAnonExclusive(page), page);
53f9263baba69f Kirill A. Shutemov 2016-01-15  1315  
5b3276bc4a2e01 Hugh Dickins       2022-11-02  1316  	if (nr_pmdmapped)
5b3276bc4a2e01 Hugh Dickins       2022-11-02  1317  		__mod_lruvec_page_state(page, NR_ANON_THPS, nr_pmdmapped);
5b3276bc4a2e01 Hugh Dickins       2022-11-02  1318  	if (nr)
be5d0a74c62d8d Johannes Weiner    2020-06-03  1319  		__mod_lruvec_page_state(page, NR_ANON_MAPPED, nr);
5ad6468801d28c Hugh Dickins       2009-12-14  1320  
cea86fe246b694 Hugh Dickins       2022-02-14  1321  	if (unlikely(PageKsm(page)))
be5d0a74c62d8d Johannes Weiner    2020-06-03  1322  		unlock_page_memcg(page);
53f9263baba69f Kirill A. Shutemov 2016-01-15  1323  
5dbe0af47f8a8f Hugh Dickins       2011-05-28  1324  	/* address might be in next vma when migration races vma_adjust */
cea86fe246b694 Hugh Dickins       2022-02-14 @1325  	else if (first)
d281ee61451835 Kirill A. Shutemov 2016-01-15  1326  		__page_set_anon_rmap(page, vma, address,
14f9135d547060 David Hildenbrand  2022-05-09  1327  				     !!(flags & RMAP_EXCLUSIVE));
69029cd550284e KAMEZAWA Hiroyuki  2008-07-25  1328  	else
c97a9e10eaee32 Nicholas Piggin    2007-05-16  1329  		__page_check_anon_rmap(page, vma, address);
cea86fe246b694 Hugh Dickins       2022-02-14  1330  
cea86fe246b694 Hugh Dickins       2022-02-14  1331  	mlock_vma_page(page, vma, compound);
^1da177e4c3f41 Linus Torvalds     2005-04-16  1332  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


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

* Re: [ammarfaizi2-block:akpm/mm/mm-unstable 160/254] mm/rmap.c:1325 page_add_anon_rmap() error: uninitialized symbol 'first'.
  2022-11-21 10:47 [ammarfaizi2-block:akpm/mm/mm-unstable 160/254] mm/rmap.c:1325 page_add_anon_rmap() error: uninitialized symbol 'first' Dan Carpenter
@ 2022-11-21 19:44 ` Andrew Morton
  2022-11-21 20:12   ` Hugh Dickins
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2022-11-21 19:44 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: oe-kbuild, Hugh Dickins, lkp, oe-kbuild-all, Ammar Faizi,
	GNU/Weeb Mailing List, Linux Memory Management List

On Mon, 21 Nov 2022 13:47:02 +0300 Dan Carpenter <[email protected]> wrote:

> tree:   https://github.com/ammarfaizi2/linux-block akpm/mm/mm-unstable
> head:   a8da2493d983a10242e6c9d71c6e828aafa5baf8
> commit: d68dde0dc6f8b8d09357a32473db8881173b10b0 [160/254] mm,thp,rmap: subpages_mapcount of PTE-mapped subpages
> config: i386-randconfig-m021
> compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <[email protected]>
> | Reported-by: Dan Carpenter <[email protected]>
> 
> smatch warnings:
> mm/rmap.c:1325 page_add_anon_rmap() error: uninitialized symbol 'first'.
> 

Thanks.  Hugh's looking into this. 
https://lkml.kernel.org/r/[email protected]

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

* Re: [ammarfaizi2-block:akpm/mm/mm-unstable 160/254] mm/rmap.c:1325 page_add_anon_rmap() error: uninitialized symbol 'first'.
  2022-11-21 19:44 ` Andrew Morton
@ 2022-11-21 20:12   ` Hugh Dickins
  2022-11-22  7:08     ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Hugh Dickins @ 2022-11-21 20:12 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Dan Carpenter, oe-kbuild, Hugh Dickins, lkp, oe-kbuild-all,
	Ammar Faizi, GNU/Weeb Mailing List, Linux Memory Management List

On Mon, 21 Nov 2022, Andrew Morton wrote:
> On Mon, 21 Nov 2022 13:47:02 +0300 Dan Carpenter <[email protected]> wrote:
> 
> > tree:   https://github.com/ammarfaizi2/linux-block akpm/mm/mm-unstable
> > head:   a8da2493d983a10242e6c9d71c6e828aafa5baf8
> > commit: d68dde0dc6f8b8d09357a32473db8881173b10b0 [160/254] mm,thp,rmap: subpages_mapcount of PTE-mapped subpages
> > config: i386-randconfig-m021
> > compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
> > 
> > If you fix the issue, kindly add following tag where applicable
> > | Reported-by: kernel test robot <[email protected]>
> > | Reported-by: Dan Carpenter <[email protected]>
> > 
> > smatch warnings:
> > mm/rmap.c:1325 page_add_anon_rmap() error: uninitialized symbol 'first'.
> > 
> 
> Thanks.  Hugh's looking into this. 
> https://lkml.kernel.org/r/[email protected]

Yes, thanks Dan: Yu Zhao already reported, the fix I sent was

https://lore.kernel.org/linux-mm/[email protected]/

but it hasn't got into mm-unstable yet.

I've not yet digested Kirill's review comments on the series (no functional
change required, I believe): maybe they will call for a v2 rather than a
series of -fixes; but let's add the above in for now.

Thanks,
Hugh

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

* Re: [ammarfaizi2-block:akpm/mm/mm-unstable 160/254] mm/rmap.c:1325 page_add_anon_rmap() error: uninitialized symbol 'first'.
  2022-11-21 20:12   ` Hugh Dickins
@ 2022-11-22  7:08     ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-11-22  7:08 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Andrew Morton, oe-kbuild, lkp, oe-kbuild-all, Ammar Faizi,
	GNU/Weeb Mailing List, Linux Memory Management List

On Mon, Nov 21, 2022 at 12:12:12PM -0800, Hugh Dickins wrote:
> On Mon, 21 Nov 2022, Andrew Morton wrote:
> > On Mon, 21 Nov 2022 13:47:02 +0300 Dan Carpenter <[email protected]> wrote:
> > 
> > > tree:   https://github.com/ammarfaizi2/linux-block akpm/mm/mm-unstable
> > > head:   a8da2493d983a10242e6c9d71c6e828aafa5baf8
> > > commit: d68dde0dc6f8b8d09357a32473db8881173b10b0 [160/254] mm,thp,rmap: subpages_mapcount of PTE-mapped subpages
> > > config: i386-randconfig-m021
> > > compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
> > > 
> > > If you fix the issue, kindly add following tag where applicable
> > > | Reported-by: kernel test robot <[email protected]>
> > > | Reported-by: Dan Carpenter <[email protected]>
> > > 
> > > smatch warnings:
> > > mm/rmap.c:1325 page_add_anon_rmap() error: uninitialized symbol 'first'.
> > > 
> > 
> > Thanks.  Hugh's looking into this. 
> > https://lkml.kernel.org/r/[email protected]
> 
> Yes, thanks Dan: Yu Zhao already reported, the fix I sent was
> 
> https://lore.kernel.org/linux-mm/[email protected]/
> 
> but it hasn't got into mm-unstable yet.

Ah good.  I did check lore before sending the bug report but I only
looked at the subjects and senders instead of reading the emails.

regards,
dan carpenter


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

end of thread, other threads:[~2022-11-22  7:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21 10:47 [ammarfaizi2-block:akpm/mm/mm-unstable 160/254] mm/rmap.c:1325 page_add_anon_rmap() error: uninitialized symbol 'first' Dan Carpenter
2022-11-21 19:44 ` Andrew Morton
2022-11-21 20:12   ` Hugh Dickins
2022-11-22  7:08     ` Dan Carpenter

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