[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] pciback: fix bug in configuration space overlay



There are a couple of bugs with the current handling of reads and writes
in the configuration space overlay functions. The wrong offset is passed
to the virtual field handlers. This patch uses the variable which
contains the correct offset. This patch also fixes the logic which
generates the actual value to write to a given virtual configuration
space field.

Signed-off-by: Ryan Wilson <hap9@xxxxxxxxxxxxxx>

--

diff -r 5baf152d63ef linux-2.6-xen-sparse/drivers/xen/pciback/conf_space.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space.c     Tue Apr  4 
14:20:12 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space.c     Tue Apr  4 
16:43:23 2006
@@ -106,7 +106,7 @@
 }
 
 static inline u32 merge_value(u32 val, u32 new_val, u32 new_val_mask,
-                             u32 offset)
+                             int offset)
 {
        if (offset >= 0) {
                new_val_mask <<= (offset * 8);
@@ -180,7 +180,8 @@
 
                if ((req_start >= field_start && req_start < field_end)
                    || (req_end > field_start && req_end <= field_end)) {
-                       err = conf_space_read(dev, cfg_entry, offset, &tmp_val);
+                       err = conf_space_read(dev, cfg_entry, field_start,
+                                             &tmp_val);
                        if (err)
                                goto out;
 
@@ -228,14 +229,16 @@
                    || (req_end > field_start && req_end <= field_end)) {
                        tmp_val = 0;
 
-                       err = pciback_config_read(dev, offset, size, &tmp_val);
+                       err = pciback_config_read(dev, field_start,
+                                                 field->size, &tmp_val);
                        if (err)
                                break;
 
                        tmp_val = merge_value(tmp_val, value, get_mask(size),
-                                             field_start - req_start);
-
-                       err = conf_space_write(dev, cfg_entry, offset, tmp_val);
+                                             req_start - field_start);
+
+                       err = conf_space_write(dev, cfg_entry, field_start,
+                                              tmp_val);
                        handled = 1;
                }
        }



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.