lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251211120448.817a352350813ae84cb600b3@linux-foundation.org>
Date: Thu, 11 Dec 2025 12:04:48 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Yankai Xu <815559068@...com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH] mm/gfp: cast GFP_ZONE_TABLE entries to long to avoid
 shift overflow

On Thu, 11 Dec 2025 18:24:05 +0800 Yankai Xu <815559068@...com> wrote:

> 
> When a new zone is added to enum zone_type in mmzone.h, the existing
> GFP_ZONE_TABLE macro causes a compile-time shift overflow.

Thanks.

Please quote the compiler warning messages and describe how to
reproduce this.  Please include this info in the patch changelog and
maintain it.

> This happens
> because enum zone_type is of type int. The shift is logically
> valid because it has been checked by 16 * GFP_ZONES_SHIFT > BITS_PER_LONG previously.
> 
> Fixed this by casting each value in GFP_ZONE_TABLE to type long.
> 
> ...
>
>  #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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ