Skip to content

Commit

Permalink
irqchip: irq-crossbar: Not allocating enough memory
Browse files Browse the repository at this point in the history
We are allocating the size of a pointer and not the size of the data.
This will lead to memory corruption.

There isn't actually a "cb_device" struct, btw.  The code is only able
to compile because GCC knows that all pointers are the same size.

Fixes: 96ca848 ('DRIVERS: IRQCHIP: CROSSBAR: Add support for Crossbar IP')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Sricharan R <r.sricharan@ti.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Link: http://lkml.kernel.org/r/20140403072134.GA14286@mwanda
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Dan Carpenter authored and Thomas Gleixner committed Apr 28, 2014
1 parent 8cc3cfc commit 3894e9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/irqchip/irq-crossbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static int __init crossbar_of_init(struct device_node *node)
int i, size, max, reserved = 0, entry;
const __be32 *irqsr;

cb = kzalloc(sizeof(struct cb_device *), GFP_KERNEL);
cb = kzalloc(sizeof(*cb), GFP_KERNEL);

if (!cb)
return -ENOMEM;
Expand Down

0 comments on commit 3894e9e

Please sign in to comment.