[<prev] [next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1203242336340.8210@swampdragon.chaosbits.net>
Date: Sat, 24 Mar 2012 23:39:18 +0100 (CET)
From: Jesper Juhl <jj@...osbits.net>
To: linux-kernel@...r.kernel.org
cc: Pierrick Hascoet <pierrick.hascoet@...lis.com>,
Devin Heitmueller <dheitmueller@...nellabs.com>,
devel@...verdev.osuosl.org, linux-media@...r.kernel.org,
Pierrick Hascoet <pierrick.hascoet@...lis.com>,
Sylwester Nawrocki <snjw23@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
trivial@...nel.org
Subject: [PATCH] staging/media/as102: Don't call release_firmware() on
uninitialized variable
If, in drivers/staging/media/as102/as102_fw.c::as102_fw_upload(), the call
cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL);
should fail and return NULL so that we jump to the 'error:' label,
then we'll end up calling 'release_firmware(firmware);' with
'firmware' still uninitialized - not good.
The easy fix is to just initialize 'firmware' to NULL when we declare
it, since release_firmware() deals gracefully with being passed NULL
pointers.
Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
drivers/staging/media/as102/as102_fw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Only compile tested.
diff --git a/drivers/staging/media/as102/as102_fw.c b/drivers/staging/media/as102/as102_fw.c
index 43ebc43..1075fb1 100644
--- a/drivers/staging/media/as102/as102_fw.c
+++ b/drivers/staging/media/as102/as102_fw.c
@@ -165,7 +165,7 @@ error:
int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap)
{
int errno = -EFAULT;
- const struct firmware *firmware;
+ const struct firmware *firmware = NULL;
unsigned char *cmd_buf = NULL;
char *fw1, *fw2;
struct usb_device *dev = bus_adap->usb_dev;
--
1.7.9.4
--
Jesper Juhl <jj@...osbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists