netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net: hns: avoid null pointer dereference
@ 2016-05-17 20:01 Heinrich Schuchardt
  2016-05-18  1:04 ` Yisen Zhuang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Heinrich Schuchardt @ 2016-05-17 20:01 UTC (permalink / raw)
  To: David S. Miller
  Cc: Yisen Zhuang, Kejian Yan, Lisheng, Kenneth Lee, Andrew Lunn,
	Salil, Qianqian Xie, huangdaode, Chenny Xu, netdev, linux-kernel,
	Heinrich Schuchardt

In the statement
  assert(priv || priv->ae_handle);
the right side of || is only evaluated if priv is null.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index 3d746c8..834a50a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -720,7 +720,7 @@ static int hns_set_pauseparam(struct net_device *net_dev,
 	struct hnae_handle *h;
 	struct hnae_ae_ops *ops;
 
-	assert(priv || priv->ae_handle);
+	assert(priv && priv->ae_handle);
 
 	h = priv->ae_handle;
 	ops = h->dev->ops;
@@ -780,7 +780,7 @@ static int hns_set_coalesce(struct net_device *net_dev,
 	struct hnae_ae_ops *ops;
 	int ret;
 
-	assert(priv || priv->ae_handle);
+	assert(priv && priv->ae_handle);
 
 	ops = priv->ae_handle->dev->ops;
 
@@ -1111,7 +1111,7 @@ void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd,
 	struct hns_nic_priv *priv = netdev_priv(net_dev);
 	struct hnae_ae_ops *ops;
 
-	assert(priv || priv->ae_handle);
+	assert(priv && priv->ae_handle);
 
 	ops = priv->ae_handle->dev->ops;
 
@@ -1135,7 +1135,7 @@ static int hns_get_regs_len(struct net_device *net_dev)
 	struct hns_nic_priv *priv = netdev_priv(net_dev);
 	struct hnae_ae_ops *ops;
 
-	assert(priv || priv->ae_handle);
+	assert(priv && priv->ae_handle);
 
 	ops = priv->ae_handle->dev->ops;
 	if (!ops->get_regs_len) {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-05-23 20:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-17 20:01 [PATCH 1/1] net: hns: avoid null pointer dereference Heinrich Schuchardt
2016-05-18  1:04 ` Yisen Zhuang
2016-05-19 11:14 ` David Laight
2016-05-19 19:20   ` [PATCH v2 " Heinrich Schuchardt
2016-05-23 20:55     ` David Miller
2016-05-19 18:26 ` [PATCH " David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).