Merge branch 'dpaa2-eth-Fix-smatch-warnings'

Ioana Radulescu says:

====================
dpaa2-eth: Fix smatch warnings

Fix a couple of warnings reported by smatch.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2019-05-26 13:41:33 -07:00
commit 66a04abf2b
3 changed files with 6 additions and 3 deletions

View File

@ -1972,7 +1972,7 @@ alloc_channel(struct dpaa2_eth_priv *priv)
channel->dpcon = setup_dpcon(priv); channel->dpcon = setup_dpcon(priv);
if (IS_ERR_OR_NULL(channel->dpcon)) { if (IS_ERR_OR_NULL(channel->dpcon)) {
err = PTR_ERR(channel->dpcon); err = PTR_ERR_OR_ZERO(channel->dpcon);
goto err_setup; goto err_setup;
} }
@ -2028,7 +2028,7 @@ static int setup_dpio(struct dpaa2_eth_priv *priv)
/* Try to allocate a channel */ /* Try to allocate a channel */
channel = alloc_channel(priv); channel = alloc_channel(priv);
if (IS_ERR_OR_NULL(channel)) { if (IS_ERR_OR_NULL(channel)) {
err = PTR_ERR(channel); err = PTR_ERR_OR_ZERO(channel);
if (err != -EPROBE_DEFER) if (err != -EPROBE_DEFER)
dev_info(dev, dev_info(dev,
"No affine channel for cpu %d and above\n", i); "No affine channel for cpu %d and above\n", i);

View File

@ -467,7 +467,7 @@ enum dpaa2_eth_rx_dist {
#define DPAA2_ETH_DIST_IPPROTO BIT(6) #define DPAA2_ETH_DIST_IPPROTO BIT(6)
#define DPAA2_ETH_DIST_L4SRC BIT(7) #define DPAA2_ETH_DIST_L4SRC BIT(7)
#define DPAA2_ETH_DIST_L4DST BIT(8) #define DPAA2_ETH_DIST_L4DST BIT(8)
#define DPAA2_ETH_DIST_ALL (~0U) #define DPAA2_ETH_DIST_ALL (~0ULL)
static inline static inline
unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv, unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv,

View File

@ -4,6 +4,7 @@
*/ */
#include <linux/net_tstamp.h> #include <linux/net_tstamp.h>
#include <linux/nospec.h>
#include "dpni.h" /* DPNI_LINK_OPT_* */ #include "dpni.h" /* DPNI_LINK_OPT_* */
#include "dpaa2-eth.h" #include "dpaa2-eth.h"
@ -648,6 +649,8 @@ static int dpaa2_eth_get_rxnfc(struct net_device *net_dev,
case ETHTOOL_GRXCLSRULE: case ETHTOOL_GRXCLSRULE:
if (rxnfc->fs.location >= max_rules) if (rxnfc->fs.location >= max_rules)
return -EINVAL; return -EINVAL;
rxnfc->fs.location = array_index_nospec(rxnfc->fs.location,
max_rules);
if (!priv->cls_rules[rxnfc->fs.location].in_use) if (!priv->cls_rules[rxnfc->fs.location].in_use)
return -EINVAL; return -EINVAL;
rxnfc->fs = priv->cls_rules[rxnfc->fs.location].fs; rxnfc->fs = priv->cls_rules[rxnfc->fs.location].fs;