From: Yisen Zhuang <Yisen.zhuang@huawei•com>
To: Heinrich Schuchardt <xypron.glpk@gmx•de>,
"David S. Miller" <davem@davemloft•net>
Cc: Kejian Yan <yankejian@huawei•com>,
Lisheng <lisheng011@huawei•com>,
Kenneth Lee <liguozhu@huawei•com>, Andrew Lunn <andrew@lunn•ch>,
Salil <salil.mehta@huawei•com>,
Qianqian Xie <xieqianqian@huawei•com>,
huangdaode <huangdaode@hisilicon•com>,
Chenny Xu <chenny.xu@huawei•com>, <netdev@vger•kernel.org>,
<linux-kernel@vger•kernel.org>
Subject: Re: [PATCH 1/1] net: hns: avoid null pointer dereference
Date: Wed, 18 May 2016 09:04:07 +0800 [thread overview]
Message-ID: <573BBF87.4010101@huawei.com> (raw)
In-Reply-To: <1463515275-9836-1-git-send-email-xypron.glpk@gmx.de>
Hi Heinrich,
This patch is fine to me.
Thanks,
Yisen
在 2016/5/18 4:01, 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) {
>
next prev parent reply other threads:[~2016-05-18 1:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-17 20:01 [PATCH 1/1] net: hns: avoid null pointer dereference Heinrich Schuchardt
2016-05-18 1:04 ` Yisen Zhuang [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=573BBF87.4010101@huawei.com \
--to=yisen.zhuang@huawei$(echo .)com \
--cc=andrew@lunn$(echo .)ch \
--cc=chenny.xu@huawei$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=huangdaode@hisilicon$(echo .)com \
--cc=liguozhu@huawei$(echo .)com \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=lisheng011@huawei$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=salil.mehta@huawei$(echo .)com \
--cc=xieqianqian@huawei$(echo .)com \
--cc=xypron.glpk@gmx$(echo .)de \
--cc=yankejian@huawei$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox