Re: [patch -next] FMC: NULL dereference on allocation failure

2013-06-20 Thread Dan Carpenter
On Wed, Jun 19, 2013 at 07:57:58PM +0200, Alessandro Rubini wrote: > I'm not a fan of kcalloc. I think it removes readability. Ok. We'll go with my original patch then. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to

Re: [patch -next] FMC: NULL dereference on allocation failure

2013-06-19 Thread Joe Perches
On Wed, 2013-06-19 at 19:57 +0200, Alessandro Rubini wrote: > >> + arr->record = kzalloc(sizeof(arr->record[0]) * n, GFP_KERNEL); > >> + arr->subtree = kzalloc(sizeof(arr->subtree[0]) * n, GFP_KERNEL); > > > n comes from the hardware no? > > Yes. Length of hardware description array. > > > May

Re: [patch -next] FMC: NULL dereference on allocation failure

2013-06-19 Thread Alessandro Rubini
>> +arr->record = kzalloc(sizeof(arr->record[0]) * n, GFP_KERNEL); >> +arr->subtree = kzalloc(sizeof(arr->subtree[0]) * n, GFP_KERNEL); > n comes from the hardware no? Yes. Length of hardware description array. > Maybe make these kcalloc too. I'm not a fan of kcalloc. I think it removes

Re: [patch -next] FMC: NULL dereference on allocation failure

2013-06-19 Thread Joe Perches
On Wed, 2013-06-19 at 19:01 +0300, Dan Carpenter wrote: > If we don't allocate "arr" then the cleanup path will dereference it and > oops. [] > diff --git a/drivers/fmc/fmc-sdb.c b/drivers/fmc/fmc-sdb.c [] > @@ -46,16 +46,17 @@ static struct sdb_array *__fmc_scan_sdb_tree(struct > fmc_device *fmc,

[patch -next] FMC: NULL dereference on allocation failure

2013-06-19 Thread Dan Carpenter
If we don't allocate "arr" then the cleanup path will dereference it and oops. Signed-off-by: Dan Carpenter Acked-by: Alessandro Rubini diff --git a/drivers/fmc/fmc-sdb.c b/drivers/fmc/fmc-sdb.c index 74fb326..79adc39 100644 --- a/drivers/fmc/fmc-sdb.c +++ b/drivers/fmc/fmc-sdb.c @@ -46,16 +46,