Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Jan 2012 18:20:43 GMT
From:      Chuck Tuffli <chuck@tuffli.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/164313: Fix pci_get_vpd_readonly_method
Message-ID:  <201201191820.q0JIKh6J065020@red.freebsd.org>
Resent-Message-ID: <201201191830.q0JIUBAF085321@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         164313
>Category:       kern
>Synopsis:       Fix pci_get_vpd_readonly_method
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 19 18:30:10 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Chuck Tuffli
>Release:        8-stable
>Organization:
>Environment:
FreeBSD tm4.lab.rv.emulex.com 8.2-STABLE FreeBSD 8.2-STABLE #32 r229528M: Thu Jan 19 09:42:27 PST 2012     ctuffli@rvctuffli.lab.rv.emulex.com:/usr/home/ctuffli/dev/releng_8/obj/usr/home/ctuffli/dev/releng_8/src/sys/DTRACE  amd64

>Description:
The pci_get_vpd_readonly_method function always returns ENXIO because it is missing a break statement if the keyword is found in the VPD read-only section. Without the break statement, the for loop continues checking the remaining keywords even if it discovers the desired key, and it exits with i == cfg->vpd.vpd_rocnt. This indistinguishable from not finding the desired key.
>How-To-Repeat:
Issue pci_get_vpd_readonly(dev, "SN", &str) to any device with a valid VPD
>Fix:
Add a break to the "if" statement

Index: sys/dev/pci/pci.c
===================================================================
--- sys/dev/pci/pci.c	(revision 229528)
+++ sys/dev/pci/pci.c	(working copy)
@@ -1076,6 +1076,7 @@
 		if (memcmp(kw, cfg->vpd.vpd_ros[i].keyword,
 		    sizeof(cfg->vpd.vpd_ros[i].keyword)) == 0) {
 			*vptr = cfg->vpd.vpd_ros[i].value;
+			break;
 		}
 
 	if (i != cfg->vpd.vpd_rocnt)


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201191820.q0JIKh6J065020>