lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 19 Jan 2015 19:43:36 +0100
From:	SF Markus Elfring <elfring@...rs.sourceforge.net>
To:	Jean-Christophe Plagniol-Villard <plagnioj@...osoft.com>,
	Tomi Valkeinen <tomi.valkeinen@...com>,
	linux-fbdev@...r.kernel.org
CC:	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org,
	Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 7/9] video: One function call less in tgafb_register() after,
 error detection

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Mon, 19 Jan 2015 15:30:45 +0100

The iounmap() function could be called in one case by the tgafb_register()
function during error handling even if the passed variable "mem_base"
contained still a null pointer.

This implementation detail could be improved by adjustments for jump labels
(according also to current Linux coding style).

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/video/fbdev/tgafb.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/video/fbdev/tgafb.c b/drivers/video/fbdev/tgafb.c
index b6fb7e8..a3cd0ef 100644
--- a/drivers/video/fbdev/tgafb.c
+++ b/drivers/video/fbdev/tgafb.c
@@ -1436,14 +1436,14 @@ static int tgafb_register(struct device *dev)
 	}
 	if (!request_mem_region (bar0_start, bar0_len, "tgafb")) {
 		printk(KERN_ERR "tgafb: cannot reserve FB region\n");
-		goto err0;
+		goto release_framebuffer;
 	}
 
 	/* Map the framebuffer.  */
 	mem_base = ioremap_nocache(bar0_start, bar0_len);
 	if (!mem_base) {
 		printk(KERN_ERR "tgafb: Cannot map MMIO\n");
-		goto err1;
+		goto release_memory_region;
 	}
 
 	/* Grab info about the card.  */
@@ -1484,13 +1484,13 @@ static int tgafb_register(struct device *dev)
 	if (ret == 0 || ret == 4) {
 		printk(KERN_ERR "tgafb: Could not find valid video mode\n");
 		ret = -EINVAL;
-		goto err1;
+		goto io_unmap;
 	}
 
 	if (fb_alloc_cmap(&info->cmap, 256, 0)) {
 		printk(KERN_ERR "tgafb: Could not allocate color map\n");
 		ret = -ENOMEM;
-		goto err1;
+		goto io_unmap;
 	}
 
 	tgafb_set_par(info);
@@ -1498,7 +1498,7 @@ static int tgafb_register(struct device *dev)
 	if (register_framebuffer(info) < 0) {
 		printk(KERN_ERR "tgafb: Could not register framebuffer\n");
 		ret = -EINVAL;
-		goto err2;
+		goto dealloc_cmap;
 	}
 
 	if (tga_bus_pci) {
@@ -1517,12 +1517,13 @@ static int tgafb_register(struct device *dev)
 
 	return 0;
 
- err2:
+dealloc_cmap:
 	fb_dealloc_cmap(&info->cmap);
- err1:
+io_unmap:
 	iounmap(mem_base);
+release_memory_region:
 	release_mem_region(bar0_start, bar0_len);
- err0:
+release_framebuffer:
 	framebuffer_release(info);
 	return ret;
 }
-- 
2.2.2

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ