Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6006370ybi; Wed, 29 May 2019 01:06:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlTvnb6tE0vuKrt9fHVzPWCxBJPlaV9+9eDeegE2YsbZLIXxo6x/ND2bpJc+A2PLCXN+Dc X-Received: by 2002:a17:90a:195e:: with SMTP id 30mr10739159pjh.116.1559117190612; Wed, 29 May 2019 01:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559117190; cv=none; d=google.com; s=arc-20160816; b=vfm/+MbMkWXiwSmMJqyfQIh89HRicm7TJ2DWCIUdnJh0PveKByYklMsKjqYTc9tfhm i58T/AAz6EnbMzEFYuqp81tGF+2OtwzOQpQNks27F7cINSmCEAwqZCGjYlOQGrQ5mdjm Dwe/okuoiRsDWuKXf3I/f8D97Gf59LLO+en+NS7S796yxPeN5lIMUn741MAP5Zg8EBbE a59I1su1t1hp8uB4AhbyVNGg3sEtG6t5gT6pDbabcDsU1WlQRtk7tWduS8h8lkMUrGjn zNj9hK9xzkO0PfP3Afqodu5C4p+wcDfmqjw3buk367fxxueh4LZA3THqYwFUN5VbqQBx vOdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EBIy8akgJJVzGMeoN5L9X2jn2x1GxoKHTkHoU0+i4ZQ=; b=MwEMd62zDov0hv/yHFY3ky7Ln2UJ1UCiT8/bvkrGw60409FhKYRdQ7bcPjIRROcnCA R4vtO05WpEUduIbSiRCI5uBFbT1Apc9OHTInWG6cZut/iNeFBtCwWJI+uSi8CSZ7RWcl kBem6pT24gRR7gQ0A0METBy2nZT5LgdRCg1tQmAB2cNCuz+XOyTugfYMVBBWygns/vJ/ YUI0+He3oM2yoPDUnEJAhazWtV9+qdBO1DxVgVUdWs44IELb2+xCttSONrN9ANqKoNOZ Kp1U7lsDw174/YjUUBuk/lhy+RS+IDGgyeLKLJLpg5OopgQgSuXqsyRtPbnB1L5Exn1n /yfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=HfhL8wqC; 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 t11si6081445pjr.52.2019.05.29.01.06.13; Wed, 29 May 2019 01:06:30 -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; dkim=pass header.i=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=HfhL8wqC; 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 S1726502AbfE2IE7 (ORCPT + 99 others); Wed, 29 May 2019 04:04:59 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:35900 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbfE2IE4 (ORCPT ); Wed, 29 May 2019 04:04:56 -0400 Received: by mail-wm1-f68.google.com with SMTP id v22so861855wml.1 for ; Wed, 29 May 2019 01:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=EBIy8akgJJVzGMeoN5L9X2jn2x1GxoKHTkHoU0+i4ZQ=; b=HfhL8wqCiookSl50jiJuT1YB5TlSuMeuNrqU2tWcfEUtEQ/AmjA+cvuYkaVQ4gKcHN wSRpxcuZF/NNGH2Y5MLanq3MH+ekyD5LIGY1quGY/RW5R5wx60RM2QX8PBTXSjr2f0LE GrSfel5vdtBCsk+50onjqOuy0SlHUJmcYWNmZ+DBqkKeGydvzo7ncC0b4i0ZsrazeUrf deHnMa1fNBN0eEKOkh+v4Ss0TZu+V2tywk5KUFTt/qlnJ5I7ACVuMx3DbtH06LlW1z78 GWgSB5/zjVexZBSTTMUPM0xJTUHJ53ZnuNkmkf6Oq1DG3cc4TV4/F0AGW1Mtw4DTfMaA KOkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=EBIy8akgJJVzGMeoN5L9X2jn2x1GxoKHTkHoU0+i4ZQ=; b=WBIzS5YCiN8t2Pb7TgJ47N0fQZCvM2yp/mOAFc08CGHS+hxFYVHAQ9/m5ir2ynGpj1 NezfwVO817qptPmspirFVYK17o7Y+GXn+Ac1aP4h2ut06Y6qBaYzZpAkmFpVcQmON9lG Z3KfAshhJ3c23JRcfwAtPUS8yMJlJOyGA92RWP4iaN9VQqiSNFkyRnDlkFrniXzGRbbH cq7Kc38TN+g3ogL4OFHND0DUjZ12jXvRvHqSeoJeajIUqQy1ggfECd/oma5WDRv+Fud3 ae+Fp18+4BXg2Mq4RYPv1j1BP+GSCAFzCNtgeuH9sn0l1e65VhDKJRzdBvzGl5NxvWlZ wzUg== X-Gm-Message-State: APjAAAWYq5DoIi1prDlT8hd8OWs4RBp1b5FbcQRy3yCsnl4coDZ3az19 JIbOi08KIYAlIZZpYO67Ib535w== X-Received: by 2002:a7b:c8c1:: with SMTP id f1mr5434256wml.159.1559117094718; Wed, 29 May 2019 01:04:54 -0700 (PDT) Received: from localhost (ip-89-177-126-215.net.upcbroadband.cz. [89.177.126.215]) by smtp.gmail.com with ESMTPSA id u9sm3165755wme.48.2019.05.29.01.04.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 May 2019 01:04:53 -0700 (PDT) Date: Wed, 29 May 2019 10:04:52 +0200 From: Jiri Pirko To: Geert Uytterhoeven Cc: 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 , linux-block@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/5] [RFC] devlink: Fix uninitialized error code in devlink_fmsg_prepare_skb() Message-ID: <20190529080452.GE2252@nanopsycho> References: <20190528142424.19626-1-geert@linux-m68k.org> <20190528142424.19626-6-geert@linux-m68k.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190528142424.19626-6-geert@linux-m68k.org> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tue, May 28, 2019 at 04:24:24PM CEST, geert@linux-m68k.org wrote: >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? 0 is correct here. Acked-by: Jiri Pirko Thanks! >--- > 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 >