From patchwork Tue May 28 14:24:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 10965069 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1973B92A for ; Tue, 28 May 2019 14:27:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A4E12889E for ; Tue, 28 May 2019 14:27:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1D13288AA; Tue, 28 May 2019 14:27:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 37E96285AD for ; Tue, 28 May 2019 14:27:29 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7C36317D1; Tue, 28 May 2019 16:26:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7C36317D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1559053647; bh=aeQ9tbfiuIuMW42cCOm1vOtx2zMH4drg0BhIbw5yTno=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=i5Wgq60W20jTvL0xyXA48XIXJ9VXd5X4bsdL+FsvXrmQrJioTfNMRYJsoHS2FUo0o +e+s5x10LmiJm3sDPyTVeaiql6EFN44nCKp/j3AHJhH0RRGlh9CFwCwNBtyCH0DCIY wmvPYgSV7HbysAwJkd2HfRjRCI/8ZJst/Fh/VD+Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 51C7BF8972D; Tue, 28 May 2019 16:24:58 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 64F1CF8970A; Tue, 28 May 2019 16:24:46 +0200 (CEST) Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BF615F89706 for ; Tue, 28 May 2019 16:24:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BF615F89706 Received: from ramsan ([84.194.111.163]) by albert.telenet-ops.be with bizsmtp id HqQS2000E3XaVaC06qQSub; Tue, 28 May 2019 16:24:41 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1hVd1e-00058P-7H; Tue, 28 May 2019 16:24:26 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1hVd1e-00057Z-4f; Tue, 28 May 2019 16:24:26 +0200 From: Geert Uytterhoeven To: Igor Konopko , David Howells , "Mohit P . Tahiliani" , Takashi Sakamoto , Eran Ben Elisha , Matias Bjorling , Jiri Pirko , "David S . Miller" , Jamal Hadi Salim , Cong Wang , Clemens Ladisch , Jaroslav Kysela , Takashi Iwai , Joe Perches , Arnd Bergmann , Dan Carpenter Date: Tue, 28 May 2019 16:24:24 +0200 Message-Id: <20190528142424.19626-6-geert@linux-m68k.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190528142424.19626-1-geert@linux-m68k.org> References: <20190528142424.19626-1-geert@linux-m68k.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Geert Uytterhoeven , linux-afs@lists.infradead.org Subject: [alsa-devel] [PATCH 5/5] [RFC] devlink: Fix uninitialized error code in devlink_fmsg_prepare_skb() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP With gcc 4.1: net/core/devlink.c: In function ‘devlink_fmsg_prepare_skb’: net/core/devlink.c:4325: warning: ‘err’ may be used uninitialized in this function Indeed, if the list has less than *start entries, an uninitialized error code will be returned. Fix this by preinitializing err to zero. Fixes: 1db64e8733f65381 ("devlink: Add devlink formatted message (fmsg) API") Signed-off-by: Geert Uytterhoeven Reviewed-by: Eran Ben Elisha Acked-by: Jiri Pirko --- I don't know if this can really happen, and if this is the right fix. Perhaps err should be initialized to some valid error code instead? --- net/core/devlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/devlink.c b/net/core/devlink.c index d43bc52b8840d76b..91377e4eae9a43c1 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -4321,8 +4321,8 @@ devlink_fmsg_prepare_skb(struct devlink_fmsg *fmsg, struct sk_buff *skb, { struct devlink_fmsg_item *item; struct nlattr *fmsg_nlattr; + int err = 0; int i = 0; - int err; fmsg_nlattr = nla_nest_start_noflag(skb, DEVLINK_ATTR_FMSG); if (!fmsg_nlattr)