mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers/gpu/vga/vgaarb.c: add missing kfree
@ 2011-08-09 12:19 Julia Lawall
  2011-08-09 12:36 ` Jesper Juhl
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2011-08-09 12:19 UTC (permalink / raw)
  To: Dave Airlie
  Cc: kernel-janitors, Andrew Morton, Rakib Mullick, Alex Deucher,
	Daniel J Blueman, linux-kernel

From: Julia Lawall <julia@diku.dk>

kbuf is a buffer that is local to this function, so all of the error paths
leaving the function should release it.

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/gpu/vga/vgaarb.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index c72f1c0..18376f1 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -993,14 +993,20 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
 				uc = &priv->cards[i];
 		}
 
-		if (!uc)
-			return -EINVAL;
+		if (!uc) {
+			ret_val = -EINVAL;
+			goto done;
+		}
 
-		if (io_state & VGA_RSRC_LEGACY_IO && uc->io_cnt == 0)
-			return -EINVAL;
+		if (io_state & VGA_RSRC_LEGACY_IO && uc->io_cnt == 0) {
+			ret_val = -EINVAL;
+			goto done;
+		}
 
-		if (io_state & VGA_RSRC_LEGACY_MEM && uc->mem_cnt == 0)
-			return -EINVAL;
+		if (io_state & VGA_RSRC_LEGACY_MEM && uc->mem_cnt == 0) {
+			ret_val = -EINVAL;
+			goto done;
+		}
 
 		vga_put(pdev, io_state);
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers/gpu/vga/vgaarb.c: add missing kfree
  2011-08-09 12:19 [PATCH] drivers/gpu/vga/vgaarb.c: add missing kfree Julia Lawall
@ 2011-08-09 12:36 ` Jesper Juhl
  0 siblings, 0 replies; 2+ messages in thread
From: Jesper Juhl @ 2011-08-09 12:36 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Dave Airlie, kernel-janitors, Andrew Morton, Rakib Mullick,
	Alex Deucher, Daniel J Blueman, linux-kernel

On Tue, 9 Aug 2011, Julia Lawall wrote:

> From: Julia Lawall <julia@diku.dk>
> 
> kbuf is a buffer that is local to this function, so all of the error paths
> leaving the function should release it.
> 

I already posted a (slightly different) patch for this : 
https://lkml.org/lkml/2011/8/1/329

Nobody has picked it up yet though :-/

Well, now those responsible have two patches to chose from :-)

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-09 12:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-09 12:19 [PATCH] drivers/gpu/vga/vgaarb.c: add missing kfree Julia Lawall
2011-08-09 12:36 ` Jesper Juhl

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®