[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [dm-devel] Re: Bug in dm-stripe.c driver
- From: Alasdair G Kergon <agk redhat com>
- To: "Wood, Brian J" <brian j wood intel com>
- Cc: device-mapper development <dm-devel redhat com>, "Healey, Douglas D" <douglas d healey intel com>, "Ciechanowski, Ed" <ed ciechanowski intel com>
- Subject: Re: [dm-devel] Re: Bug in dm-stripe.c driver
- Date: Wed, 21 Nov 2007 19:42:14 +0000
On Wed, Nov 21, 2007 at 07:39:32PM +0000, Alasdair G Kergon wrote:
> On Wed, Nov 21, 2007 at 11:15:52AM -0800, Wood, Brian J wrote:
> > /***** Here's the problem spot *****/
> > struct stripe stripe[0];
>
> That one must remain the last element in the struct.
> Add any new fields above it.
Here's how the real size is calculated before it's allocated:
static inline struct stripe_c *alloc_context(unsigned int stripes)
{
size_t len;
if (array_too_big(sizeof(struct stripe_c), sizeof(struct stripe),
stripes))
return NULL;
len = sizeof(struct stripe_c) + (sizeof(struct stripe) * stripes);
return kmalloc(len, GFP_KERNEL);
}
Alasdair
--
agk redhat com
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]