From patchwork Wed Jun 16 15:33:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 462070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D365AC49361 for ; Wed, 16 Jun 2021 15:35:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFBBE613C1 for ; Wed, 16 Jun 2021 15:35:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234854AbhFPPhM (ORCPT ); Wed, 16 Jun 2021 11:37:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:50126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234793AbhFPPgx (ORCPT ); Wed, 16 Jun 2021 11:36:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 31828613C7; Wed, 16 Jun 2021 15:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623857686; bh=BYIYTlizhazvwA/ycfrbXSk+j1HNLyl4SnXOEnTLaSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VkJ48CBd8pe3JhC4tncIptkWhI1S+tyuUFpgij1i7rkaUq7TRRu9EjBN0r815bOLx /ACi3MXQ2rLp9CWvm5HN6FM2TXzhRVYQdqmnK9WlGNlj6GqfsGDLKTbDeyEAI/bErd uJZzPfJfHwiGi0UJopwu3bKP/DMi+5hPHfQKpWyw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abaci Robot , Jiapeng Chong , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 25/28] rtnetlink: Fix missing error code in rtnl_bridge_notify() Date: Wed, 16 Jun 2021 17:33:36 +0200 Message-Id: <20210616152834.948561762@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210616152834.149064097@linuxfoundation.org> References: <20210616152834.149064097@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jiapeng Chong [ Upstream commit a8db57c1d285c758adc7fb43d6e2bad2554106e1 ] The error code is missing in this code scenario, add the error code '-EINVAL' to the return value 'err'. Eliminate the follow smatch warning: net/core/rtnetlink.c:4834 rtnl_bridge_notify() warn: missing error code 'err'. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/core/rtnetlink.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 73c09b5864d7..bdeb169a7a99 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -4535,8 +4535,10 @@ static int rtnl_bridge_notify(struct net_device *dev) if (err < 0) goto errout; - if (!skb->len) + if (!skb->len) { + err = -EINVAL; goto errout; + } rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); return 0;