* [patch] irqchip/irq-crossbar: not allocating enough memory
@ 2014-04-03 7:21 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2014-04-03 7:21 UTC (permalink / raw)
To: Thomas Gleixner, Sricharan R
Cc: Grant Likely, Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
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: 96ca848ef7ea ('DRIVERS: IRQCHIP: CROSSBAR: Add support for Crossbar IP')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index fc817d2..3d15d16 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -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;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [patch] irqchip/irq-crossbar: not allocating enough memory
@ 2014-04-03 7:21 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2014-04-03 7:21 UTC (permalink / raw)
To: Thomas Gleixner, Sricharan R
Cc: Grant Likely, Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
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: 96ca848ef7ea ('DRIVERS: IRQCHIP: CROSSBAR: Add support for Crossbar IP')
Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index fc817d2..3d15d16 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -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;
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [patch] irqchip/irq-crossbar: not allocating enough memory
@ 2014-04-03 7:21 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2014-04-03 7:21 UTC (permalink / raw)
To: Thomas Gleixner, Sricharan R
Cc: Grant Likely, Rob Herring, linux-kernel, devicetree,
kernel-janitors
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: 96ca848ef7ea ('DRIVERS: IRQCHIP: CROSSBAR: Add support for Crossbar IP')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index fc817d2..3d15d16 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -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;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [patch] irqchip/irq-crossbar: not allocating enough memory
2014-04-03 7:21 ` Dan Carpenter
(?)
@ 2014-04-04 6:30 ` Sricharan R
-1 siblings, 0 replies; 7+ messages in thread
From: Sricharan R @ 2014-04-04 6:30 UTC (permalink / raw)
To: Dan Carpenter
Cc: Thomas Gleixner, Grant Likely, Rob Herring,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On Thursday 03 April 2014 12:51 PM, Dan Carpenter wrote:
> 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: 96ca848ef7ea ('DRIVERS: IRQCHIP: CROSSBAR: Add support for Crossbar IP')
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>
> diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
> index fc817d2..3d15d16 100644
> --- a/drivers/irqchip/irq-crossbar.c
> +++ b/drivers/irqchip/irq-crossbar.c
> @@ -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;
Yes. correct. Thanks for the catch.
Acked-by: Sricharan R <r.sricharan-l0cyMroinI0@public.gmane.org>
Regards,
Sricharan
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] irqchip/irq-crossbar: not allocating enough memory
@ 2014-04-04 6:30 ` Sricharan R
0 siblings, 0 replies; 7+ messages in thread
From: Sricharan R @ 2014-04-04 6:30 UTC (permalink / raw)
To: Dan Carpenter
Cc: Thomas Gleixner, Grant Likely, Rob Herring, linux-kernel,
devicetree, kernel-janitors
On Thursday 03 April 2014 12:51 PM, Dan Carpenter wrote:
> 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: 96ca848ef7ea ('DRIVERS: IRQCHIP: CROSSBAR: Add support for Crossbar IP')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
> index fc817d2..3d15d16 100644
> --- a/drivers/irqchip/irq-crossbar.c
> +++ b/drivers/irqchip/irq-crossbar.c
> @@ -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;
Yes. correct. Thanks for the catch.
Acked-by: Sricharan R <r.sricharan@ti.com>
Regards,
Sricharan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] irqchip/irq-crossbar: not allocating enough memory
@ 2014-04-04 6:30 ` Sricharan R
0 siblings, 0 replies; 7+ messages in thread
From: Sricharan R @ 2014-04-04 6:42 UTC (permalink / raw)
To: Dan Carpenter
Cc: Thomas Gleixner, Grant Likely, Rob Herring,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On Thursday 03 April 2014 12:51 PM, Dan Carpenter wrote:
> 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: 96ca848ef7ea ('DRIVERS: IRQCHIP: CROSSBAR: Add support for Crossbar IP')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
> index fc817d2..3d15d16 100644
> --- a/drivers/irqchip/irq-crossbar.c
> +++ b/drivers/irqchip/irq-crossbar.c
> @@ -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;
Yes. correct. Thanks for the catch.
Acked-by: Sricharan R <r.sricharan@ti.com>
Regards,
Sricharan
^ permalink raw reply [flat|nested] 7+ messages in thread
* [tip:irq/urgent] irqchip: irq-crossbar: Not allocating enough memory
2014-04-03 7:21 ` Dan Carpenter
` (2 preceding siblings ...)
(?)
@ 2014-04-28 19:45 ` tip-bot for Dan Carpenter
-1 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Dan Carpenter @ 2014-04-28 19:45 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, grant.likely, hpa, mingo, robh+dt, r.sricharan,
tglx, dan.carpenter
Commit-ID: 3894e9e82dfdc87fa35dc7976e0472d220228826
Gitweb: http://git.kernel.org/tip/3894e9e82dfdc87fa35dc7976e0472d220228826
Author: Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate: Thu, 3 Apr 2014 10:21:34 +0300
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 28 Apr 2014 21:43:24 +0200
irqchip: irq-crossbar: Not allocating enough memory
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: 96ca848ef7ea ('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>
---
drivers/irqchip/irq-crossbar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index fc817d2..3d15d16 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -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;
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-04-28 19:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-03 7:21 [patch] irqchip/irq-crossbar: not allocating enough memory Dan Carpenter
2014-04-03 7:21 ` Dan Carpenter
2014-04-03 7:21 ` Dan Carpenter
2014-04-04 6:30 ` Sricharan R
2014-04-04 6:42 ` Sricharan R
2014-04-04 6:30 ` Sricharan R
2014-04-28 19:45 ` [tip:irq/urgent] irqchip: irq-crossbar: Not " tip-bot for Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.