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]
Date:	Tue, 9 Feb 2016 16:30:51 -0800
From:	David Decotigny <ddecotig@...il.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	"David S. Miller" <davem@...emloft.net>,
	Ben Hutchings <ben@...adent.org.uk>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-api@...r.kernel.org" <linux-api@...r.kernel.org>,
	linux-mips@...ux-mips.org, fcoe-devel@...n-fcoe.org,
	Tejun Heo <tj@...nel.org>, Eric Dumazet <edumazet@...gle.com>,
	Eugenia Emantayev <eugenia@...lanox.co.il>,
	Or Gerlitz <ogerlitz@...lanox.com>,
	Ido Shamay <idos@...lanox.com>, Joe Perches <joe@...ches.com>,
	Saeed Mahameed <saeedm@...lanox.com>,
	Govindarajulu Varadarajan <_govind@....com>,
	Venkata Duvvuru <VenkatKumar.Duvvuru@...lex.com>,
	Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
	Pravin B Shelar <pshelar@...ira.com>,
	Ed Swierk <eswierk@...portsystems.com>,
	Robert Love <robert.w.love@...el.com>,
	"James E.J. Bottomley" <JBottomley@...allels.com>,
	Yuval Mintz <Yuval.Mintz@...gic.com>,
	Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: Re: [PATCH net-next v7 01/19] lib/bitmap.c: conversion routines
 to/from u32 array

thanks. done in v8 I am sending right now.

On Mon, Feb 8, 2016 at 3:36 PM, Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Sun,  7 Feb 2016 17:08:45 -0800 David Decotigny <ddecotig@...il.com> wrote:
>
>> From: David Decotigny <decot@...glers.com>
>>
>> Aimed at transferring bitmaps to/from user-space in a 32/64-bit agnostic
>> way.
>>
>> Tested:
>>   unit tests (next patch) on qemu i386, x86_64, ppc, ppc64 BE and LE,
>>   ARM.
>>
>> @@ -1060,6 +1062,90 @@ int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order)
>>  EXPORT_SYMBOL(bitmap_allocate_region);
>>
>>  /**
>> + * bitmap_from_u32array - copy the contents of a u32 array of bits to bitmap
>> + *   @bitmap: array of unsigned longs, the destination bitmap, non NULL
>> + *   @nbits: number of bits in @bitmap
>> + *   @buf: array of u32 (in host byte order), the source bitmap, non NULL
>> + *   @nwords: number of u32 words in @buf
>> + *
>> + * copy min(nbits, 32*nwords) bits from @buf to @bitmap, remaining
>> + * bits between nword and nbits in @bitmap (if any) are cleared. In
>> + * last word of @bitmap, the bits beyond nbits (if any) are kept
>> + * unchanged.
>> + */
>
> This will leave the caller not knowing how many valid bits are actually
> present in the resulting bitmap.  To determine that, the caller will
> need to perform (duplicated) math on `nbits' and `nwords'.
>
>> +void bitmap_from_u32array(unsigned long *bitmap, unsigned int nbits,
>> +                       const u32 *buf, unsigned int nwords)
>
> So how about we make this return the number of valid bits in *bitmap?
>
>> +/**
>> + * bitmap_to_u32array - copy the contents of bitmap to a u32 array of bits
>> + *   @buf: array of u32 (in host byte order), the dest bitmap, non NULL
>> + *   @nwords: number of u32 words in @buf
>> + *   @bitmap: array of unsigned longs, the source bitmap, non NULL
>> + *   @nbits: number of bits in @bitmap
>> + *
>> + * copy min(nbits, 32*nwords) bits from @bitmap to @buf. Remaining
>> + * bits after nbits in @buf (if any) are cleared.
>> + */
>> +void bitmap_to_u32array(u32 *buf, unsigned int nwords,
>> +                     const unsigned long *bitmap, unsigned int nbits)
>
> Ditto.
>
>

Powered by blists - more mailing lists