qede: Fix the static checker warnings.
authorSudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Tue, 28 Jun 2016 06:10:59 +0000 (02:10 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 29 Jun 2016 11:53:35 +0000 (07:53 -0400)
Static checker warnings:
drivers/net/ethernet/qlogic/qede/qede_ethtool.c:435 qede_get_coalesce()
warn: passing casted pointer '&coal->rx_coalesce_usecs' to
'edev->ops->common->get_coalesce()' 32 vs 16.

The u32 pointer is being typecasted to u16 which may fail for big-endian
platforms.

Fixes: d552fa84cb35 ("qede: Add support for coalescing config read/update.")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qede/qede_ethtool.c

index 6228482bf7f06fd2bf218210cd8f7abf7c701211..c5c658ab0724a3591982647da66ed93035300614 100644 (file)
@@ -430,11 +430,13 @@ static int qede_get_coalesce(struct net_device *dev,
                             struct ethtool_coalesce *coal)
 {
        struct qede_dev *edev = netdev_priv(dev);
+       u16 rxc, txc;
 
        memset(coal, 0, sizeof(struct ethtool_coalesce));
-       edev->ops->common->get_coalesce(edev->cdev,
-                                       (u16 *)&coal->rx_coalesce_usecs,
-                                       (u16 *)&coal->tx_coalesce_usecs);
+       edev->ops->common->get_coalesce(edev->cdev, &rxc, &txc);
+
+       coal->rx_coalesce_usecs = rxc;
+       coal->tx_coalesce_usecs = txc;
 
        return 0;
 }