Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5098447ybi; Tue, 28 May 2019 07:31:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9g4xy9c+PSwQZ7bE4yaKRjjM0YaSRPXDKo4dgHJLGOnwl5LfLSF+pANqRqmee0P1bx4bw X-Received: by 2002:a63:42:: with SMTP id 63mr134090521pga.337.1559053884100; Tue, 28 May 2019 07:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559053884; cv=none; d=google.com; s=arc-20160816; b=EHAjvSYu32ioWpaalz1DaY/IiG7ZgZppJuhjWG3jiQWmmmQ3HN/1cl6kwCxfNYRAta hDVLAS0zcAZr84hngmKT4KJ57imCTi4IHnwF+mqN8zmRpCQ2loFbmFUS1mT+k/xsATyg 5jKZfkP/D65SoBqjJNQTGpBWZ/LaDzG0/lusAAD6wegLUlHO0970YVyhROrrRcgRDQM6 LG2g4hSMGu0AWRWgTX3c/mTyipoFbnGkWreYd2UtiQBHy2P/08YtRDWR5tWhg+ztrsJv q1WzJX0edtMEpulpOkCQk0oedZvdrUMSAOmYJc4g6iLjMqa6+2dxoWI7NMJ/Q/22skQr Op3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=thoCEGx7ciAPgZysiQlJ8v7SHDXNmZfS5ED/APD5xi8=; b=MvtyAxdy8dz/iU6kd3Kx08dowg7rWAhAciqdQG3hLJ77g4SrXwl8HjiKiYAD109WcA Wnx9kBm79fqIQPvGvY1aL9eFOQSeeJ4AumSPnJTzemeZ9xqqKr8bfO+iWY6RRNGsXfQf Yf7H7smrcQI6ZKfKqf4zE/6awHGkwH2rn1cUZs2FZ08WS9zKmuOe8XE5UUJBek0wyZGH 9yr+8v/eHUrdbBezGRnTPcQ1BdNSHk//ZahbwCeTvtMiDdRhcqv71jztxBvdAqUObG5T m85B/rPS/wRtTj5G1Dxr0QH8qnErti4MQjdVlNZHKMbrURavqUc7nY+hrRlQX3h4eoX2 yaDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id go3si21542441plb.423.2019.05.28.07.31.08; Tue, 28 May 2019 07:31:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727738AbfE1OZJ (ORCPT + 99 others); Tue, 28 May 2019 10:25:09 -0400 Received: from albert.telenet-ops.be ([195.130.137.90]:39126 "EHLO albert.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727598AbfE1OYo (ORCPT ); Tue, 28 May 2019 10:24:44 -0400 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 Cc: linux-block@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 5/5] [RFC] devlink: Fix uninitialized error code in devlink_fmsg_prepare_skb() 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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) -- 2.17.1