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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+CK2bAHrq30ss1oH2uqBAPg-vbyyeYGdOVUJLrdOEcRCwk8tA@mail.gmail.com>
Date: Thu, 25 Jul 2024 10:25:16 -0400
From: Pasha Tatashin <pasha.tatashin@...een.com>
To: Yosry Ahmed <yosryahmed@...gle.com>
Cc: akpm@...ux-foundation.org, jpoimboe@...nel.org, kent.overstreet@...ux.dev, 
	peterz@...radead.org, nphamcs@...il.com, cerasuolodomenico@...il.com, 
	surenb@...gle.com, lizhijian@...itsu.com, willy@...radead.org, 
	shakeel.butt@...ux.dev, vbabka@...e.cz, ziy@...dia.com, 
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v5 1/3] memcg: increase the valid index range for memcg stats

> >  #define NR_MEMCG_NODE_STAT_ITEMS ARRAY_SIZE(memcg_node_stat_items)
> >  #define MEMCG_VMSTAT_SIZE (NR_MEMCG_NODE_STAT_ITEMS + \
> >                            ARRAY_SIZE(memcg_stat_items))
> > -static int8_t mem_cgroup_stats_index[MEMCG_NR_STAT] __read_mostly;
> > +#define IS_INVALID(index) ((index) == U8_MAX)
>
> The use of this macro extends well into this file, should we use a
> more specific name (e.g. IS_VALID_STATS_IDX())?

I will redefine it like this:
#define BAD_STAT_IDX(index) ((u32)(index) >= U8_MAX)

1. A descriptive yet short name.
2. Check if the index is equal or larger than U8_MAX, which feels safer.

Pasha

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ