From: Yankai Xu <815559068@qq.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm/gfp: cast GFP_ZONE_TABLE entries to long to avoid shift overflow
Date: Fri, 12 Dec 2025 15:19:23 +0800 [thread overview]
Message-ID: <tencent_A2549F7433365BF2FC86A5FE39F888956C06@qq.com> (raw)
In-Reply-To: <20251211120448.817a352350813ae84cb600b3@linux-foundation.org>
Hi Andrew,
Thanks for the review.
> Please quote the compiler warning messages and describe how to
> reproduce this. Please include this info in the patch changelog and
> maintain it.
I have included them in patch v2. Here's the LKML link for reference:
https://lore.kernel.org/lkml/tencent_DAB2E2BC61A449B6AC4FA9798C4D75BED705@qq.com/T/#/u
> > #define GFP_ZONE_TABLE ( \
> > - (ZONE_NORMAL << 0 * GFP_ZONES_SHIFT) \
> > + ((long)ZONE_NORMAL << 0 * GFP_ZONES_SHIFT) \
>
> It would be nice to find something nicer than this. Perhaps a type of
> something was poorly chosen.
ZONE_NORMAL, ZONE_DMA32, etc. are enum values, which has an underlying
type of int. Changing either the underlying type or the enum type
itself is not feasible. Moreover, the shift overflow only occurs inside
GFP_ZONE_TABLE, modifying other code might be unnecessary. Adding
explicit casts seems to be the most straightforward solution here.
Thanks,
Yankai
prev parent reply other threads:[~2025-12-12 7:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-11 10:24 Yankai Xu
2025-12-11 20:04 ` Andrew Morton
2025-12-12 7:19 ` Yankai Xu [this message]
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=tencent_A2549F7433365BF2FC86A5FE39F888956C06@qq.com \
--to=815559068@qq.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox