Skip to content

Commit a326e6d

Browse files
Wei Yongjundavem330
authored andcommitted
team: fix return value check
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 <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7f8436a commit a326e6d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/net/team/team.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,8 +1653,8 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
16531653

16541654
hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq,
16551655
&team_nl_family, 0, TEAM_CMD_NOOP);
1656-
if (IS_ERR(hdr)) {
1657-
err = PTR_ERR(hdr);
1656+
if (!hdr) {
1657+
err = -EMSGSIZE;
16581658
goto err_msg_put;
16591659
}
16601660

@@ -1848,8 +1848,8 @@ static int team_nl_send_options_get(struct team *team, u32 pid, u32 seq,
18481848

18491849
hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags | NLM_F_MULTI,
18501850
TEAM_CMD_OPTIONS_GET);
1851-
if (IS_ERR(hdr))
1852-
return PTR_ERR(hdr);
1851+
if (!hdr)
1852+
return -EMSGSIZE;
18531853

18541854
if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
18551855
goto nla_put_failure;
@@ -2068,8 +2068,8 @@ static int team_nl_fill_port_list_get(struct sk_buff *skb,
20682068

20692069
hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags,
20702070
TEAM_CMD_PORT_LIST_GET);
2071-
if (IS_ERR(hdr))
2072-
return PTR_ERR(hdr);
2071+
if (!hdr)
2072+
return -EMSGSIZE;
20732073

20742074
if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
20752075
goto nla_put_failure;

0 commit comments

Comments
 (0)