Re: [KJ] [PATCH] Correct misc_register return code handling in several drivers

Neil Horman
2006-10-23T18:17:47Z

On Mon, Oct 23, 2006 at 11:01:36AM -0700, Dan Carpenter wrote:
> On 10/23/06, Neil Horman <nhorman@tuxdriver.com> wrote:
> >+out3:
> >+ for_each_online_node(node) {
> >+ if(timers[node] != NULL)
> >+ kfree(timers[node]);
> >+ }
>
> Tharindu is going to be unhappy out if he sees that. There is a
> possibility that timers[node] is uninitialized. if node[0] is null
> then node[1] is uninitialized and it's going to cause a crash.
>
> regards,
> dan carpenter

Theres a memset to ensure that all the timer pointers are initalized to NULL in
the patch:

@@ -709,16 +710,18 @@ static int __init mmtimer_init(void)
if (timers == NULL) {
printk(KERN_ERR "%s: failed to allocate memory for device\n",
MMTIMER_NAME);
- return -1;
+ goto out2;
}

+ memset(timers,0,(sizeof(mmtimer_t *)*maxn));
+

--
/***************************************************
*Neil Horman
*Software Engineer
*gpg keyid: 1024D / 0x92A74FA1 - http://pgp.mit.edu
***************************************************/