From: Joe Perches <joe@perches.com>
To: Himangi Saraogi <himangi774@gmail.com>
Cc: linux-kernel@vger.kernel.org, julia.lawall@lip6.fr
Subject: Re: [PATCH] thunderbolt: Correct the size argument to devm_kzalloc
Date: Sun, 06 Jul 2014 09:31:03 -0700 [thread overview]
Message-ID: <1404664263.27043.35.camel@joe-AO725> (raw)
In-Reply-To: <20140706161342.GA6267@himangi-Dell>
On Sun, 2014-07-06 at 21:43 +0530, Himangi Saraogi wrote:
> nhi->rx_rings does not have type as struct tb_ring *, as it is a
> double pointer so the elements of the array should have pointer type,
> not structure type.
[]
> diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
[]
> @@ -570,10 +570,10 @@ static int nhi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> INIT_WORK(&nhi->interrupt_work, nhi_interrupt_work);
>
> nhi->tx_rings = devm_kzalloc(&pdev->dev,
> - nhi->hop_count * sizeof(struct tb_ring),
> + nhi->hop_count * sizeof(*nhi->tx_rings),
> GFP_KERNEL);
> nhi->rx_rings = devm_kzalloc(&pdev->dev,
> - nhi->hop_count * sizeof(struct tb_ring),
> + nhi->hop_count * sizeof(*nhi->rx_rings),
> GFP_KERNEL);
It could use devm_kcalloc here too.
btw: are there many false positives with the cocci test?
next prev parent reply other threads:[~2014-07-06 16:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-06 16:13 Himangi Saraogi
2014-07-06 16:31 ` Joe Perches [this message]
2014-07-06 23:58 ` Greg KH
2014-07-07 4:32 ` Julia Lawall
2014-07-07 5:42 ` Greg KH
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=1404664263.27043.35.camel@joe-AO725 \
--to=joe@perches.com \
--cc=himangi774@gmail.com \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®