From patchwork Tue Sep 25 04:29:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 186692 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 11C232C0083 for ; Tue, 25 Sep 2012 14:29:41 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751978Ab2IYE3g (ORCPT ); Tue, 25 Sep 2012 00:29:36 -0400 Received: from mail-qc0-f174.google.com ([209.85.216.174]:42116 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751024Ab2IYE3f (ORCPT ); Tue, 25 Sep 2012 00:29:35 -0400 Received: by qcro28 with SMTP id o28so4947577qcr.19 for ; Mon, 24 Sep 2012 21:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=Tbxp3LszRjSf0LcEPRH1DBAQqH7OSWhVwCaJPCFm/TY=; b=oZoka/813Mx1EVB3d3E0UekaV9puSWttvXGqIMsG3jQpp6mxY+W5qY1H5nZJHzWRbV miPsHkOVKRt2Qs7mdDQYniQBH+ryE7VENk03PeagNxKI0f6d8UMX/J6BRwouMFWNKrEy lSE9ispliVvKE+cuGLjqyWtDaEcPm7zhDdIfJjfz2tJSGirSTCWPsPe3FhLLa42gQGNa cQhSbb61dfyMIA3+vTBP+j89l7yqs2oCYlnOGDSJLsog8jv2+4VAUB1ULwlSpzRSk7Ty XQrov4GDiuJhT57ZY9JicX9zFsNEVH4Zn1fYQy5IWNXbozZUHk0TBrKzAoRD9oYhAo8Z vYqw== MIME-Version: 1.0 Received: by 10.224.179.7 with SMTP id bo7mr36914459qab.96.1348547375248; Mon, 24 Sep 2012 21:29:35 -0700 (PDT) Received: by 10.229.146.194 with HTTP; Mon, 24 Sep 2012 21:29:35 -0700 (PDT) Date: Tue, 25 Sep 2012 12:29:35 +0800 Message-ID: Subject: [PATCH] team: fix return value check From: Wei Yongjun To: jpirko@redhat.com Cc: yongjun_wei@trendmicro.com.cn, netdev@vger.kernel.org Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Wei Yongjun 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 Acked-by: Jiri Pirko --- drivers/net/team/team.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 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 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;