>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     
[email protected]:/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:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to