Re: [PATCH] flex_array: Change behaviour on zero size allocations

From: Steffen Klassert
Date: Wed Feb 02 2011 - 02:55:27 EST


On Tue, Feb 01, 2011 at 10:20:22AM -0500, Eric Paris wrote:
>
> I'm fine with any solution. It's obviously broken for SELinux to be
> passing -1 even if the library supported it. I guess I don't really
> have strong feelings on how to fix it.
>
> 1) make end exclusive
> 2) change 'end' to 'len'
> 3) just make selinux not prealloc() when the #elements == 0
>
> All seem perfectly reasonable to me, but I'd probably do them in that
> order.
>

I think I would prefer option 2. Passing a size or a length to
a memory allocator is quite common and we would not need to care
for bugs where 'end' is smaller than 'start'.

So I'd do it like that, if noone has strong feelings for another option.

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/