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] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0908241323360.5574@chino.kir.corp.google.com>
Date:	Mon, 24 Aug 2009 13:29:46 -0700 (PDT)
From:	David Rientjes <rientjes@...gle.com>
To:	Dave Hansen <dave@...ux.vnet.ibm.com>
cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [patch 2/4 -mm] flex_array: add flex_array_clear function

On Mon, 24 Aug 2009, Dave Hansen wrote:

> My only worry about this is that it's largely a copy-and-paste of
> flex_array_put().  If we had a function that just returned a pointer to
> 'dst', we could use that in both cases.  
> 
> Couldn't we implement the above with just:
> 
> int flex_array_clear(struct flex_array *fa, unsigned int element_nr)
> {
> 	return flex_array_put(fa, element_nr, &empty_zero_page);
> }
> 

Sure, if you never increase FLEX_ARRAY_PART_SIZE.  Otherwise, doing

static char zero_part[FLEX_ARRAY_PART_SIZE] = {
	[0 ... FLEX_ARRAY_PART_SIZE - 1] = 0
};

and using flex_array_put(fa, element_nr, &zero_part) would work although 
you're trading off cleaner, yet not more efficient, code at the cost of 
FLEX_ARRAY_PART_SIZE wasted memory and memcpy() being slower than 
memset().
--
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