LKML Archive on
help / color / mirror / Atom feed
From: Steffen Klassert <>
To: Dave Hansen <>
Cc: Andrew Morton <>,
	Eric Paris <>,,
Subject: Re: [PATCH] flex_array: Change behaviour on zero size allocations
Date: Tue, 1 Feb 2011 12:03:11 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Tue, Feb 01, 2011 at 11:24:18AM +0100, Steffen Klassert wrote:
> Both objections are correct, I'll send an updated patch.

I think we need to fix selinux too to get rid of the policy loading
problem. In security/selinux/ss/policydb.c are several pieces of code
like this one:

p->type_val_to_struct_array = flex_array_alloc(sizeof(struct type_datum *),   
                                               GFP_KERNEL | __GFP_ZERO);
if (!p->type_val_to_struct_array)      
	goto out;

rc = flex_array_prealloc(p->type_val_to_struct_array, 0,
                         p->p_types.nprim - 1, GFP_KERNEL | __GFP_ZERO);
if (rc)
	goto out;

If p->p_types.nprim is zero, we allocare with total_nr_elements equal
to zerro and then we try to prealloc with p->p_types.nprim - 1.
flex_array_prealloc interprets this as an unsigned int and fails,
because this is bigger than total_nr_elements, which is correct I think.



  reply	other threads:[~2011-02-01 11:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-31  8:52 Steffen Klassert
2011-01-31 16:31 ` Dave Hansen
2011-02-01 10:24   ` Steffen Klassert
2011-02-01 11:03     ` Steffen Klassert [this message]
2011-02-01 14:55       ` Dave Hansen
2011-02-01 15:20         ` Eric Paris
2011-02-02  7:55           ` Steffen Klassert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] flex_array: Change behaviour on zero size allocations' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).