From: Bjorn Helgaas <bhelgaas@google.com>
To: Alan <gnomes@lxorguk.ukuu.org.uk>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH] pci: allocation check missing
Date: Tue, 11 Feb 2014 16:28:45 -0700 [thread overview]
Message-ID: <20140211232845.GC21057@google.com> (raw)
In-Reply-To: <20140205115412.14423.23707.stgit@alan.etchedpixels.co.uk>
On Wed, Feb 05, 2014 at 11:54:34AM +0000, Alan wrote:
> If we fail to allocate the name, just drop nicely into the fail path
>
> (as a footnote someone who works on this code more might want to shuffle
> the allocations about so the name and attributes are allocated and freed
> as one. There seems to be no reason to keep them separate)
>
> Signed-off-by: Alan Cox <alan@linux.intel.com>
I already applied Greg KH's identical patch, thanks! :)
http://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/commit/?h=pci/msi&id=b3bac8e57c82e8d3e05f4abcb18c4f0a40656655
> ---
> drivers/pci/msi.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 18ca2497..9bdf290 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -544,9 +544,13 @@ static int populate_msi_sysfs(struct pci_dev *pdev)
> return -ENOMEM;
> list_for_each_entry(entry, &pdev->msi_list, list) {
> char *name = kmalloc(20, GFP_KERNEL);
> + if (!name)
> + goto error_attrs;
> msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL);
> - if (!msi_dev_attr)
> + if (!msi_dev_attr) {
> + kfree(name);
> goto error_attrs;
> + }
> sprintf(name, "%d", entry->irq);
> sysfs_attr_init(&msi_dev_attr->attr);
> msi_dev_attr->attr.name = name;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2014-02-11 23:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-05 11:54 [PATCH] pci: allocation check missing Alan
2014-02-11 23:28 ` Bjorn Helgaas [this message]
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=20140211232845.GC21057@google.com \
--to=bhelgaas@google.com \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=linux-pci@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;
as well as URLs for NNTP newsgroup(s).