* [PATCH] team: fix return value check
@ 2012-09-25 4:29 Wei Yongjun
2012-09-25 5:40 ` Jiri Pirko
2012-09-27 17:18 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2012-09-25 4:29 UTC (permalink / raw)
To: jpirko; +Cc: yongjun_wei, netdev
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
In case of error, the function genlmsg_put() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test.
dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/net/team/team.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 341b65d..e19da26 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1652,8 +1652,8 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq,
&team_nl_family, 0, TEAM_CMD_NOOP);
- if (IS_ERR(hdr)) {
- err = PTR_ERR(hdr);
+ if (!hdr) {
+ err = -EMSGSIZE;
goto err_msg_put;
}
@@ -1847,8 +1847,8 @@ start_again:
hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags | NLM_F_MULTI,
TEAM_CMD_OPTIONS_GET);
- if (IS_ERR(hdr))
- return PTR_ERR(hdr);
+ if (!hdr)
+ return -EMSGSIZE;
if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
goto nla_put_failure;
@@ -2067,8 +2067,8 @@ static int team_nl_fill_port_list_get(struct sk_buff *skb,
hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags,
TEAM_CMD_PORT_LIST_GET);
- if (IS_ERR(hdr))
- return PTR_ERR(hdr);
+ if (!hdr)
+ return -EMSGSIZE;
if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
goto nla_put_failure;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] team: fix return value check
2012-09-25 4:29 [PATCH] team: fix return value check Wei Yongjun
@ 2012-09-25 5:40 ` Jiri Pirko
2012-09-27 17:18 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2012-09-25 5:40 UTC (permalink / raw)
To: Wei Yongjun; +Cc: jpirko, yongjun_wei, netdev
Tue, Sep 25, 2012 at 06:29:35AM CEST, weiyj.lk@gmail.com wrote:
>From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
>In case of error, the function genlmsg_put() returns NULL pointer
>not ERR_PTR(). The IS_ERR() test in the return value check should
>be replaced with NULL test.
>
>dpatch engine is used to auto generate this patch.
>(https://github.com/weiyj/dpatch)
>
>Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>---
> drivers/net/team/team.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index 341b65d..e19da26 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -1652,8 +1652,8 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
>
> hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq,
> &team_nl_family, 0, TEAM_CMD_NOOP);
>- if (IS_ERR(hdr)) {
>- err = PTR_ERR(hdr);
>+ if (!hdr) {
>+ err = -EMSGSIZE;
> goto err_msg_put;
> }
>
>@@ -1847,8 +1847,8 @@ start_again:
>
> hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags | NLM_F_MULTI,
> TEAM_CMD_OPTIONS_GET);
>- if (IS_ERR(hdr))
>- return PTR_ERR(hdr);
>+ if (!hdr)
>+ return -EMSGSIZE;
>
> if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
> goto nla_put_failure;
>@@ -2067,8 +2067,8 @@ static int team_nl_fill_port_list_get(struct sk_buff *skb,
>
> hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags,
> TEAM_CMD_PORT_LIST_GET);
>- if (IS_ERR(hdr))
>- return PTR_ERR(hdr);
>+ if (!hdr)
>+ return -EMSGSIZE;
>
> if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
> goto nla_put_failure;
>
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
Acked-by: Jiri Pirko <jiri@resnulli.us>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] team: fix return value check
2012-09-25 4:29 [PATCH] team: fix return value check Wei Yongjun
2012-09-25 5:40 ` Jiri Pirko
@ 2012-09-27 17:18 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-09-27 17:18 UTC (permalink / raw)
To: weiyj.lk; +Cc: jpirko, yongjun_wei, netdev
From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Tue, 25 Sep 2012 12:29:35 +0800
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> In case of error, the function genlmsg_put() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should
> be replaced with NULL test.
>
> dpatch engine is used to auto generate this patch.
> (https://github.com/weiyj/dpatch)
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-27 17:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-25 4:29 [PATCH] team: fix return value check Wei Yongjun
2012-09-25 5:40 ` Jiri Pirko
2012-09-27 17:18 ` 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).