Coverity: page_zone(): Memory - corruptions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221102 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Tue Nov 1 17:26:18 2022 -0700
    5cb2ae82a4c4 ("mm: simplify page_zone() and get_deferred_split_queue() with page_pgdat()")

Coverity reported the following:

*** CID 1527097:  Memory - corruptions  (OVERRUN)
/include/linux/mm.h: 1458 in page_zone()
1452     {
1453     	return NODE_DATA(page_to_nid(page));
1454     }
1455
1456     static inline struct zone *page_zone(const struct page *page)
1457     {
vvv     CID 1527097:  Memory - corruptions  (OVERRUN)
vvv     "&page_pgdat(page)->node_zones[page_zonenum(page)]" evaluates to an address that is at byte offset 114688 of an array of 81920 bytes.
1458     	return &page_pgdat(page)->node_zones[page_zonenum(page)];
1459     }
1460
1461     static inline struct zone *folio_zone(const struct folio *folio)
1462     {
1463     	return page_zone(&folio->page);

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <keescook+coverity-bot@xxxxxxxxxxxx>
Addresses-Coverity-ID: 1527097 ("Memory - corruptions")
Fixes: 5cb2ae82a4c4 ("mm: simplify page_zone() and get_deferred_split_queue() with page_pgdat()")

The problem appears to be the difference between page_zonenum()
returning up to ZONES_MASK-many, and node_zones[] being sized
precisely...

Thanks for your attention!

-- 
Coverity-bot



[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux