Skip to contentSkip to conversation

nvidiafb: fix unreachable code in nv10GetConfig

PATCH In review Nathan Lynch 3 participants 4 messages Nov 8, 2006 – Nov 12, 2006 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvidiafb: fix unreachable code in nv10GetConfig

Fix binary/logical operator typo which leads to unreachable code. Noticed while looking at other issues; I don't have the relevant hardware to test this.

drivers/video/nvidia/nv_setup.c +1 -1
@@ -262,7 +262,7 @@ static void nv10GetConfig(struct nvidia_
 #endif
 
 	dev = pci_find_slot(0, 1);
-	if ((par->Chipset && 0xffff) == 0x01a0) {
+	if ((par->Chipset & 0xffff) == 0x01a0) {
 		int amt = 0;
 
 		pci_read_config_dword(dev, 0x7c, &amt);
#1 lore raw
Quoted 10 lines · On Wed, 8 Nov 2006 13:55:11 -0600 Nathan Lynch <[email protected]> wrote:

Fix binary/logical operator typo which leads to unreachable code. Noticed while looking at other issues; I don't have the relevant hardware to test this.

drivers/video/nvidia/nv_setup.c static void nv10GetConfig(struct nvidia_ · line 268

Quoted 8 lines
drivers/video/nvidia/nv_setup.c +1 -1
@@ -262,7 +262,7 @@ static void nv10GetConfig(struct nvidia_
 #endif
 
 	dev = pci_find_slot(0, 1);
-	if ((par->Chipset && 0xffff) == 0x01a0) {
+	if ((par->Chipset & 0xffff) == 0x01a0) {
 		int amt = 0;
 
 		pci_read_config_dword(dev, 0x7c, &amt);

That looks like a pretty significant bug. It'll cause the kernel to potentially map the wrong amount of memory for all cards except the NV_ARCH_04 type. Has been there for over a year though. hmm..

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#2 lore raw
Quoted 20 lines · Andrew Morton
Quoted 17 lines · On Wed, 8 Nov 2006 13:55:11 -0600 Nathan Lynch <[email protected]> wrote:

Fix binary/logical operator typo which leads to unreachable code. Noticed while looking at other issues; I don't have the relevant hardware to test this.

drivers/video/nvidia/nv_setup.c +1 -1
@@ -262,7 +262,7 @@ static void nv10GetConfig(struct nvidia_
 #endif
 
 	dev = pci_find_slot(0, 1);
-	if ((par->Chipset && 0xffff) == 0x01a0) {
+	if ((par->Chipset & 0xffff) == 0x01a0) {
 		int amt = 0;
 
Quoted 5 lines

drivers/video/nvidia/nv_setup.c static void nv10GetConfig(struct nvidia_ · line 268

Quoted 1 line
drivers/video/nvidia/nv_setup.c +0 -0
 		pci_read_config_dword(dev, 0x7c, &amt);

That looks like a pretty significant bug. It'll cause the kernel to potentially map the wrong amount of memory for all cards except the NV_ARCH_04 type. Has been there for over a year though. hmm..

Did some searching, and assuming that chipset == PCI device id (dubious?), I think the bug would affect only some integrated GeForce2 cards, which are somewhat old.

It looks to me like the other devices handled by nv10GetConfig would still be handled as intended, but I'm not familiar with this code.

#3 lore raw
Quoted 28 lines
Quoted 20 lines · Andrew Morton
Quoted 17 lines · On Wed, 8 Nov 2006 13:55:11 -0600 Nathan Lynch <[email protected]> wrote:

Fix binary/logical operator typo which leads to unreachable code. Noticed while looking at other issues; I don't have the relevant hardware to test this.

drivers/video/nvidia/nv_setup.c +1 -1
@@ -262,7 +262,7 @@ static void nv10GetConfig(struct nvidia_
 #endif
 
 	dev = pci_find_slot(0, 1);
-	if ((par->Chipset && 0xffff) == 0x01a0) {
+	if ((par->Chipset & 0xffff) == 0x01a0) {
 		int amt = 0;
 
Quoted 5 lines

drivers/video/nvidia/nv_setup.c static void nv10GetConfig(struct nvidia_ · line 268

Quoted 1 line
drivers/video/nvidia/nv_setup.c +0 -0
 		pci_read_config_dword(dev, 0x7c, &amt);

That looks like a pretty significant bug. It'll cause the kernel to potentially map the wrong amount of memory for all cards except the NV_ARCH_04 type. Has been there for over a year though. hmm..

Quoted 7 lines

Did some searching, and assuming that chipset == PCI device id (dubious?), I think the bug would affect only some integrated GeForce2 cards, which are somewhat old.

It looks to me like the other devices handled by nv10GetConfig would still be handled as intended, but I'm not familiar with this code.

Your assumption is correct :-)