[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1297184561.6737.12074.camel@nimitz>
Date: Tue, 08 Feb 2011 09:02:41 -0800
From: Dave Hansen <dave@...ux.vnet.ibm.com>
To: Steffen Klassert <steffen.klassert@...unet.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Eric Paris <eparis@...hat.com>, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org
Subject: Re: [PATCH v2] flex_array: Change behaviour on zero size
allocations
On Mon, 2011-02-07 at 13:29 +0100, Steffen Klassert wrote:
> int flex_array_prealloc(struct flex_array *fa, unsigned int start,
> - unsigned int end, gfp_t flags)
> + unsigned int nr_elements, gfp_t flags)
> {
> int start_part;
> int end_part;
> int part_nr;
> + unsigned int end;
> struct flex_array_part *part;
>
> - if (start >= fa->total_nr_elements || end >= fa->total_nr_elements)
> + if (!fa->total_nr_elements && !start)
> + return 0;
> + if (start >= fa->total_nr_elements)
> + return -ENOSPC;
> + if (!nr_elements)
> + return 0;
> +
> + end = start + nr_elements - 1;
> +
> + if (end >= fa->total_nr_elements)
> return -ENOSPC;
> + if (!fa->element_size)
> + return 0;
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.
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.
-- 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