All of lore.kernel.org
 help / color / mirror / Atom feed
From: coverity-bot <keescook@chromium.org>
To: Yajun Deng <yajun.deng@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	linux-next@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Coverity: page_zone(): Memory - corruptions
Date: Wed, 2 Nov 2022 12:52:16 -0700	[thread overview]
Message-ID: <202211021251.632286C@keescook> (raw)

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@chromium.org>
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

                 reply	other threads:[~2022-11-02 19:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202211021251.632286C@keescook \
    --to=keescook@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=gustavo@embeddedor.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=yajun.deng@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.