Commit 4093666e authored by Charles Jacobsen's avatar Charles Jacobsen Committed by Vikram Narayanan

I think I found the bug. Improper kmalloc.

parent 2105b19d
......@@ -45,10 +45,10 @@ struct automobile * dealer_buy_car(void)
/*
* Alloc caller copy of hierarchy
*/
a = kmalloc(sizeof(a), GFP_KERNEL);
a = kmalloc(sizeof(*a), GFP_KERNEL);
if (!a)
goto fail1;
e = kmalloc(sizeof(e), GFP_KERNEL);
e = kmalloc(sizeof(*e), GFP_KERNEL);
if (!e)
goto fail2;
a->engine = e;
......
......@@ -250,7 +250,7 @@ struct engine * mk_engine_caller(int cylinders)
/*
* Alloc caller copy
*/
e = kmalloc(sizeof(e), GFP_KERNEL);
e = kmalloc(sizeof(*e), GFP_KERNEL);
if (!e)
goto fail1;
e->cylinders = cylinders;
......@@ -288,7 +288,7 @@ struct automobile * mk_automobile_caller(struct engine *e, int doors)
/*
* Alloc caller copy
*/
a = kmalloc(sizeof(a), GFP_KERNEL);
a = kmalloc(sizeof(*a), GFP_KERNEL);
if (!a)
goto fail1;
a->engine = e;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment