From: Rolf Eike Beer <eike@sf-mail.de>
To: Jesper Juhl <jj@chaosbits.net>
Cc: linux-kernel@vger.kernel.org, Jing Huang <huangj@brocade.com>,
linux-scsi@vger.kernel.org, James.Bottomley@suse.de
Subject: Re: [PATCH][RESEND] SCSI, Brocade FC HBA: Remember to always release_firmware() so we don't leak memory.
Date: Thu, 24 Mar 2011 08:02:10 +0100 [thread overview]
Message-ID: <2959663.zb4mtM3Vnv@donald.sf-tec.de> (raw)
In-Reply-To: <alpine.LNX.2.00.1103232356510.28372@swampdragon.chaosbits.net>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="US-ASCII", Size: 1335 bytes --]
Am Donnerstag, 24. März 2011, 00:00:39 schrieb Jesper Juhl:
> Once we've called request_firmware() we must remember to call
> release_firmware() to free memory. We don't currently do this in
> bfad_read_firmware(); causing a memory leak.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> Acked-by: Jing Huang <huangj@brocade.com>
> ---
> bfad.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> Could someone merge this please?
>
> diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
> index 44524cf..d7bafeb 100644
> --- a/drivers/scsi/bfa/bfad.c
> +++ b/drivers/scsi/bfa/bfad.c
> @@ -1558,23 +1558,22 @@ bfad_read_firmware(struct pci_dev *pdev, u32
> **bfi_image,
>
> if (request_firmware(&fw, fw_name, &pdev->dev)) {
> printk(KERN_ALERT "Can't locate firmware %s\n", fw_name);
> - goto error;
> + *bfi_image = NULL;
> + goto out;
> }
A simple "return NULL;" here is enough, there is nothing that could be freed
later on.
Looking a bit deeper I think the interface of this function is totally b0rked:
-it has a return value that is always the same as one of the arguments
(+dereference)
-noone ever checks this return value
-at least in my tree it is never called from anywhere outside this file but is
still exported and not static
Eike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
prev parent reply other threads:[~2011-03-24 7:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-23 23:00 Jesper Juhl
2011-03-24 7:02 ` Rolf Eike Beer [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=2959663.zb4mtM3Vnv@donald.sf-tec.de \
--to=eike@sf-mail.de \
--cc=James.Bottomley@suse.de \
--cc=huangj@brocade.com \
--cc=jj@chaosbits.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@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
Powered by JetHome