Skip to content

Commit

Permalink
qede: Fix the static checker warnings.
Browse files Browse the repository at this point in the history
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: d552fa8 ("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>
  • Loading branch information
Sudarsana Reddy Kalluru authored and David S. Miller committed Jun 29, 2016
1 parent 51d9988 commit d2890de
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/ethernet/qlogic/qede/qede_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d2890de

Please sign in to comment.