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]
Date:	Wed, 02 Sep 2009 10:26:42 -0700
From:	Dave Hansen <dave@...ux.vnet.ibm.com>
To:	David Rientjes <rientjes@...gle.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [patch 1/2 -mm] flex_array: introduce DEFINE_FLEX_ARRAY

On Tue, 2009-09-01 at 20:14 -0700, David Rientjes wrote:
> @@ -152,7 +136,8 @@ static unsigned int index_inside_part(struct
> flex_array *fa,
>  {
>         unsigned int part_offset;
> 
> -       part_offset = element_nr % __elements_per_part(fa->element_size);
> +       part_offset = element_nr %
> +                               FLEX_ARRAY_ELEMENTS_PER_PART(fa->element_size);
>         return part_offset * fa->element_size;
>  }

This all looks pretty good.  The only issue is that the macro name
lengths have gotten a bit out of hand.  

For instance.  This:

#define FLEX_ARRAY_ELEMENTS_PER_PART(size)                             \
       (FLEX_ARRAY_PART_SIZE / size)

ends up being longer in practice than just open-coding the operation:

	FLEX_ARRAY_ELEMENTS_PER_PART(fa->element_size)                      

vs.

	(FLEX_ARRAY_PART_SIZE / fa->element_size)

and the length also ends up making for a couple of pretty ugly line
wraps.

Otherwise, this is fine with me.

Acked-by: Dave Hansen <dave@...ux.vnet.ibm.com>

-- Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ