public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sricharan R <r.sricharan@ti.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <robh+dt@kernel.org>, <linux-kernel@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: Re: [patch] irqchip/irq-crossbar: not allocating enough memory
Date: Fri, 4 Apr 2014 12:00:36 +0530	[thread overview]
Message-ID: <533E518C.5020807@ti.com> (raw)
In-Reply-To: <20140403072134.GA14286@mwanda>

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

  reply	other threads:[~2014-04-04  6:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03  7:21 [patch] irqchip/irq-crossbar: not allocating enough memory Dan Carpenter
2014-04-04  6:30 ` Sricharan R [this message]
2014-04-28 19:45 ` [tip:irq/urgent] irqchip: irq-crossbar: Not " tip-bot for Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=533E518C.5020807@ti.com \
    --to=r.sricharan@ti.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox