Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1233367pxu; Fri, 16 Oct 2020 07:13:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxS7u9KUOjXMqMQFOXaZqMlkAKh2xNi/+qjs6+S15h1IpMDiah9hiq9JckvU88UAO9zfhAm X-Received: by 2002:a05:6402:10c6:: with SMTP id p6mr4207045edu.76.1602857616973; Fri, 16 Oct 2020 07:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602857616; cv=none; d=google.com; s=arc-20160816; b=JuqWa3gCTtKOdPnT0uoDv6Wx9w85vxQpwdY2isOGzBgCbdHznKz+6yJioDjBpmAGdF 9hHQ9V9WKJjksWsxS9gxRhig/gR2dqM/XDQtrZV/psUviR+/sdo8mGjTEgarUeJJ/xtY 3bRZyKFMnGclD0S5rL4KtMo5G29vjWZYML+85JnR+QXLg1GN1qRAOAUGsQXVE8Y153Ju KDq1vYJswQnHLvm5oB2WwxwwVsSyA+Ol4zTeQwgypZIw9APfpKuf8+h4QUVKWisPPLYx +MEWNfZBX+wk2mndA48OPs2vxYkgHT0Cfv7x3B/uBKuktiUwLxZlL2qQTAE8/2/YiexL 8jqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=THjfTOP8IbDhym5O8SO8LJblnPfb1lWR9dsL100yaRg=; b=bBguRd0S2V4uWMRWTPw0lWg94OBxzNNyqVrsNAiKTA9ID9w6hpNxzPNqaODPn90HcR qhbGb6EdZDkwxKyOQIxLlgEKOafLlLpzJhKCT/ML6MHQcIM4SFqSzwl8pXTSogNAyIu7 NuUpYSjsyLB8zeJrbWf08NQxf42Q9sM04ZpoUrNMWOzi1TTXE+eRO73+MBDF5H+armY2 enz8yH2aM693PCL4aU3tZz8GpAqmvOOgI3aAx1wBGfmXYTKxEeaj7U/ZBmEtYDsReC0o nYfkA5xzO+gJWRwVidUouySBP29uWtl1IBLq04r5ZOJSz1HmIS875mw4HAxwQjXYWAXJ v/+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mj10si1684884ejb.723.2020.10.16.07.13.13; Fri, 16 Oct 2020 07:13:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406389AbgJPJtG (ORCPT + 99 others); Fri, 16 Oct 2020 05:49:06 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:39779 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405433AbgJPJtG (ORCPT ); Fri, 16 Oct 2020 05:49:06 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kTMMB-00054p-U9; Fri, 16 Oct 2020 09:49:03 +0000 Subject: Re: [PATCH] vfio/fsl-mc: fix the return of the uninitialized variable ret To: Diana Craciun OSS , Alex Williamson Cc: Cornelia Huck , Eric Auger , kvm@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20201015122226.485911-1-colin.king@canonical.com> <20201015125211.3ff46dc1@w520.home> <65c7ffdb-fa92-102d-d7d1-29bb7d39fcb7@oss.nxp.com> From: Colin Ian King Message-ID: <556df27a-d4aa-ccbf-7559-52b7c0e05c0f@canonical.com> Date: Fri, 16 Oct 2020 10:49:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.2 MIME-Version: 1.0 In-Reply-To: <65c7ffdb-fa92-102d-d7d1-29bb7d39fcb7@oss.nxp.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/10/2020 10:26, Diana Craciun OSS wrote: > On 10/15/2020 9:52 PM, Alex Williamson wrote: >> On Thu, 15 Oct 2020 13:22:26 +0100 >> Colin King wrote: >> >>> From: Colin Ian King >>> >>> Currently the success path in function vfio_fsl_mc_reflck_attach is >>> returning an uninitialized value in variable ret. Fix this by setting >>> this to zero to indicate success. >>> >>> Addresses-Coverity: ("Uninitialized scalar variable") >>> Fixes: f2ba7e8c947b ("vfio/fsl-mc: Added lock support in preparation >>> for interrupt handling") >>> Signed-off-by: Colin Ian King >>> --- >>>   drivers/vfio/fsl-mc/vfio_fsl_mc.c | 1 + >>>   1 file changed, 1 insertion(+) >>> >>> diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c >>> b/drivers/vfio/fsl-mc/vfio_fsl_mc.c >>> index 80fc7f4ed343..42a5decb78d1 100644 >>> --- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c >>> +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c >>> @@ -84,6 +84,7 @@ static int vfio_fsl_mc_reflck_attach(struct >>> vfio_fsl_mc_device *vdev) >>>           vfio_fsl_mc_reflck_get(cont_vdev->reflck); >>>           vdev->reflck = cont_vdev->reflck; >>>           vfio_device_put(device); >>> +        ret = 0; >>>       } >>>     unlock: >> >> Looks correct to me, unless Diana would rather set the initial value to >> zero instead.  Thanks, >> >> Alex >> > > > I prefer to initialize the variable to 0 when it's defined. I'll send a > patch for it. Yep, works for me. > > Thanks, > Diana