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>] [day] [month] [year] [list]
Date:	Tue, 19 Oct 2010 13:53:52 -0300
From:	Davidlohr Bueso <dave.bueso@...il.com>
To:	Paul Mackerras <paulus@...ba.org>, grant.likely@...retlab.ca,
	alex.kern@....de, benh@...nel.crashing.org, mpatocka@...hat.com
Cc:	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] ATI FB driver: fix variable size warnings

ATI FB driver: fix variable size warnings and get rid of two unused variables.

Basically revert the order of the for-loop and get rid of the ARRAY_SIZE()-1 bit, which causes the warning. The iterations produce the exact same result: exit if the PCI id is found. Otherwise (if no device is found, then 'i' should be the same value of the size of the amount of elements in the array).
My current randconfig showed the following:

drivers/video/aty/atyfb_base.c: In function ‘correct_chipset’:
drivers/video/aty/atyfb_base.c:441: warning: overflow in implicit constant conversion

This is compile-tested only.

PS: Not sure who deals with this, so please include CC if you know.

Thanks.
Davidlohr

Signed-off-by: Davidlohr Bueso <dave@....org>
---
 drivers/video/aty/atyfb_base.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index f8d69ad..7771142 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -436,13 +436,13 @@ static int __devinit correct_chipset(struct atyfb_par *par)
 	u16 type;
 	u32 chip_id;
 	const char *name;
-	int i;
-
-	for (i = ARRAY_SIZE(aty_chips) - 1; i >= 0; i--)
+	int i, arrsize = ARRAY_SIZE(aty_chips);
+	
+	for (i = 0; i < arrsize; i++)
 		if (par->pci_id == aty_chips[i].pci_id)
 			break;
 
-	if (i < 0)
+	if (i == arrsize)
 		return -ENODEV;
 
 	name = aty_chips[i].name;
@@ -535,8 +535,6 @@ static int __devinit correct_chipset(struct atyfb_par *par)
 	return 0;
 }
 
-static char ram_dram[] __devinitdata = "DRAM";
-static char ram_resv[] __devinitdata = "RESV";
 #ifdef CONFIG_FB_ATY_GX
 static char ram_vram[] __devinitdata = "VRAM";
 #endif /* CONFIG_FB_ATY_GX */
-- 
1.7.0.4



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