]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
enic: fix an endian bug in enic_probe()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 29 Feb 2012 21:19:54 +0000 (21:19 +0000)
committerJoe Jin <joe.jin@oracle.com>
Wed, 29 Aug 2012 00:22:13 +0000 (08:22 +0800)
"num_vfs" is a u32 but we only use the high 16 bits and the low 16bits
are left as zero.  That isn't a problem for little endian systems but it
will break on big endian ones.

(cherry picked from commit 413708bbaf5c85c4c8a264145f7d6c3afcd97f99)
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/net/enic/enic.h
drivers/net/enic/enic_main.c

index 99998c606d3e2f97bebca9db4692fe2d6da82b20..cf1fb4b9a4adff6fbd5904fd31d4dfdef3c97bf9 100644 (file)
@@ -94,7 +94,7 @@ struct enic {
        u32 rx_coalesce_usecs;
        u32 tx_coalesce_usecs;
 #ifdef CONFIG_PCI_IOV
-       u32 num_vfs;
+       u16 num_vfs;
 #endif
        struct enic_port_profile *pp;
 
index 6af16df7a4d7e92dff12e74b5d0cce51c91359d7..f16ea2e6564c372215e41d0b4ff56d1be0c83a3d 100644 (file)
@@ -2398,7 +2398,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
        pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
        if (pos) {
                pci_read_config_word(pdev, pos + PCI_SRIOV_TOTAL_VF,
-                       (u16 *)&enic->num_vfs);
+                       &enic->num_vfs);
                if (enic->num_vfs) {
                        err = pci_enable_sriov(pdev, enic->num_vfs);
                        if (err) {