RE: [PATCH 3/3] netxen: qlogic ethernet : Fix Endian Bug.

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

 



Santosh,

Thanks for pointing out the bug. But adapter takes  ip in big endian format.
So no need to use  be32_to_cpu instead data type of ip should be changed to __be32.
Also in netxen_config_ipaddr()
-      req.words[1] = cpu_to_le64(ip);
+      req.words[1] = ip;

Rest looks fine.

Rajesh
________________________________________
From: santosh nayak [santoshprasadnayak@xxxxxxxxx]
Sent: Friday, March 02, 2012 8:41 PM
To: Sony Chacko
Cc: Rajesh Borundia; netdev; linux-kernel; kernel-janitors@xxxxxxxxxxxxxxx; Santosh Nayak
Subject: [PATCH 3/3] netxen: qlogic ethernet : Fix Endian Bug.

From: Santosh Nayak <santoshprasadnayak@xxxxxxxxx>

Fix endian bug.
Add a default case in 'netxen_list_config_vlan_ip'

Signed-off-by: Santosh Nayak <santoshprasadnayak@xxxxxxxxx>
---
 .../net/ethernet/qlogic/netxen/netxen_nic_main.c   |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 8dc4a134..971b286 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -818,7 +818,7 @@ netxen_check_options(struct netxen_adapter *adapter)
                        adapter->driver_mismatch = 1;
                        return;
                }
-               ptr32[i] = cpu_to_le32(val);
+               ptr32[i] = val;
                offset += sizeof(u32);
        }

@@ -3028,7 +3028,7 @@ netxen_list_config_vlan_ip(struct netxen_adapter *adapter,
                list_for_each(head, &adapter->vlan_ip_list) {
                        cur = list_entry(head, struct nx_vlan_ip_list, list);

-                       if (cur->ip_addr == ifa->ifa_address)
+                       if (cur->ip_addr == be32_to_cpu(ifa->ifa_address))
                                return;
                }

@@ -3039,18 +3039,22 @@ netxen_list_config_vlan_ip(struct netxen_adapter *adapter,
                        return;
                }

-               cur->ip_addr = ifa->ifa_address;
+               cur->ip_addr = be32_to_cpu(ifa->ifa_address);
                list_add_tail(&cur->list, &adapter->vlan_ip_list);
                break;
        case NX_IP_DOWN:
                list_for_each_entry_safe(cur, tmp_cur,
                                        &adapter->vlan_ip_list, list) {
-                       if (cur->ip_addr == ifa->ifa_address) {
+                       if (cur->ip_addr == be32_to_cpu(ifa->ifa_address)) {
                                list_del(&cur->list);
                                kfree(cur);
                                break;
                        }
                }
+               break;
+       default:
+               printk(KERN_ERR "%ld: Wrong event id \n", event);
+               break;
        }
 }
 static void
@@ -3070,12 +3074,12 @@ netxen_config_indev_addr(struct netxen_adapter *adapter,
                switch (event) {
                case NETDEV_UP:
                        netxen_config_ipaddr(adapter,
-                                       ifa->ifa_address, NX_IP_UP);
+                                       be32_to_cpu(ifa->ifa_address), NX_IP_UP);
                        netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP);
                        break;
                case NETDEV_DOWN:
                        netxen_config_ipaddr(adapter,
-                                       ifa->ifa_address, NX_IP_DOWN);
+                                       be32_to_cpu(ifa->ifa_address), NX_IP_DOWN);
                        netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN);
                        break;
                default:
@@ -3167,11 +3171,11 @@ recheck:

        switch (event) {
        case NETDEV_UP:
-               netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_UP);
+               netxen_config_ipaddr(adapter, be32_to_cpu(ifa->ifa_address), NX_IP_UP);
                netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP);
                break;
        case NETDEV_DOWN:
-               netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_DOWN);
+               netxen_config_ipaddr(adapter, be32_to_cpu(ifa->ifa_address), NX_IP_DOWN);
                netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN);
                break;
        default:
--
1.7.4.4



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Discussion]     [TCP Instrumentation]     [Ethernet Bridging]     [Linux Wireless Networking]     [Linux WPAN Networking]     [Linux Host AP]     [Linux WPAN Networking]     [Linux Bluetooth Networking]     [Linux ATH6KL Networking]     [Linux Networking Users]     [Linux Coverity]     [VLAN]     [Git]     [IETF Annouce]     [Linux Assembly]     [Security]     [Bugtraq]     [Yosemite Information]     [MIPS Linux]     [ARM Linux Kernel]     [ARM Linux]     [Linux Virtualization]     [Linux IDE]     [Linux RAID]     [Linux SCSI]