Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1403934
| From | Heinrich Schuchardt <xypron.glpk@gmx.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 1/1] net: hns: avoid null pointer dereference |
| Date | 2016-05-19 21:30 +0200 |
| Message-ID | <rABNT-3Uc-3@gated-at.bofh.it> (permalink) |
| References | <rAu9H-7pe-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
In the statement
assert(priv || priv->ae_handle);
the right side of || is only evaluated if priv is null.
v2:
As suggested by David Leight and David Miller the assert
statements are removed.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index 3d746c8..67a648c 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -46,7 +46,6 @@ static u32 hns_nic_get_link(struct net_device *net_dev)
u32 link_stat = priv->link;
struct hnae_handle *h;
- assert(priv && priv->ae_handle);
h = priv->ae_handle;
if (priv->phy) {
@@ -646,8 +645,6 @@ static void hns_nic_get_drvinfo(struct net_device *net_dev,
{
struct hns_nic_priv *priv = netdev_priv(net_dev);
- assert(priv);
-
strncpy(drvinfo->version, HNAE_DRIVER_VERSION,
sizeof(drvinfo->version));
drvinfo->version[sizeof(drvinfo->version) - 1] = '\0';
@@ -720,8 +717,6 @@ static int hns_set_pauseparam(struct net_device *net_dev,
struct hnae_handle *h;
struct hnae_ae_ops *ops;
- assert(priv || priv->ae_handle);
-
h = priv->ae_handle;
ops = h->dev->ops;
@@ -780,8 +775,6 @@ static int hns_set_coalesce(struct net_device *net_dev,
struct hnae_ae_ops *ops;
int ret;
- assert(priv || priv->ae_handle);
-
ops = priv->ae_handle->dev->ops;
if (ec->tx_coalesce_usecs != ec->rx_coalesce_usecs)
@@ -1111,8 +1104,6 @@ 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);
-
ops = priv->ae_handle->dev->ops;
cmd->version = HNS_CHIP_VERSION;
@@ -1135,8 +1126,6 @@ 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);
-
ops = priv->ae_handle->dev->ops;
if (!ops->get_regs_len) {
netdev_err(net_dev, "ops->get_regs_len is null!\n");
--
2.1.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/1] net: hns: avoid null pointer dereference Heinrich Schuchardt <xypron.glpk@gmx.de> - 2016-05-17 22:10 +0200
Re: [PATCH 1/1] net: hns: avoid null pointer dereference Yisen Zhuang <Yisen.zhuang@huawei.com> - 2016-05-18 03:10 +0200
RE: [PATCH 1/1] net: hns: avoid null pointer dereference David Laight <David.Laight@ACULAB.COM> - 2016-05-19 13:20 +0200
[PATCH v2 1/1] net: hns: avoid null pointer dereference Heinrich Schuchardt <xypron.glpk@gmx.de> - 2016-05-19 21:30 +0200
Re: [PATCH v2 1/1] net: hns: avoid null pointer dereference David Miller <davem@davemloft.net> - 2016-05-23 23:00 +0200
Re: [PATCH 1/1] net: hns: avoid null pointer dereference David Miller <davem@davemloft.net> - 2016-05-19 20:30 +0200
csiph-web