Re: [PATCH v2] flex_array: Change behaviour on zero sizeallocations

From: Steffen Klassert
Date: Fri Feb 11 2011 - 04:25:28 EST


On Tue, Feb 08, 2011 at 09:02:41AM -0800, Dave Hansen wrote:
>
> The rest of this patch looks good. When you resend, you need to break
> this up in to at least two patches: one to change 'end' to
> 'nr_elements' (or something else) and the one to handle zero-sized
> elements and arrays.

Ok.

>
> I also think we need to remove the ability to do zero-sized elements.
> Unless there's some new code that I'm missing, I don't see any of the
> existing security policy code which would be able to do that.
>

Well, from the selinux policy point of view we don't need the ability
to handle zero-sized elements. But why you want to remove it? I don't
see a reason why zero-sized elements should be handled different form
zero number of elements. This could again produce a pitfall for potential
new flex_array users.

Anyway, for the moment I'm just interested to load my selinux policy.
So we could return -EINVAL is somebody tries to allocate with element
size zero if you think it should be like that.

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