Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1629490pxa; Thu, 6 Aug 2020 11:59:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6Dmc5R4OCuRfOy41en9gNSHCbAA0YxQ9QuvOWM6b9SOJdiffmOqjLUdm+xjhr+2ZKLRgU X-Received: by 2002:a17:906:60c6:: with SMTP id f6mr5496649ejk.265.1596740379379; Thu, 06 Aug 2020 11:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596740379; cv=none; d=google.com; s=arc-20160816; b=x1ol7aJJ4m4/Tg9ZSDPPYz5d9ew1UWWm9swKigNJZYe9wUQV5LbTPd1a+OqX0+1Gi3 IyQPgQg30bSJihDpjIPPdIR9OIHpr3Pig+IGIf2NBzaPlK/KY7UYT0CrQAZ/YDIA7gLu NRFOnLtEn7CFUZaNagTiUsuAwRKvHE/D8/lGmM6nTXYKld6x/lMUyCBiJfKJ5CvuIlc1 QK/jqyxlhe0YMZabF05mlbgOEaI1YNEp+LvyYfJndQyr5/c8pdYWi3KpL+ePX78Xnu4L fYG/zgUhtiiPqygn4BGCdln/CqF22ZfHrgmXLUhGxowKtvN4rxPFMT4WhsPLyJv8Oebo ggXw== 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 :message-id:date:subject:to:from:dkim-signature; bh=pBgAjgCog8Mlp2V45xeCh6aLH9cVKGklcK4JhV8qHJE=; b=qr/smIEeU//zKJtfoilWnm7U6YkVWO5Mv9ogo2gnK7Qvl1uG/fD4r3GDYXFCz1qcUr Yw1dnbfENf/GBHqBtqz8m5jNKjzL4Ga/o86JVePVywCyR9vts05TVPFadxXsIqWC2UAv c+ohQKFLFAQm8FS7XOR8FRoLnuAdK3FWj8epwz9w0cJBQOMxGOaKFMSVrognXFcSJHAe tjVEgEVjHv1OE8BtIhaHdXcqIKy3bc2El6eTYTEz0k9wz8+UXwkmuI1h1jth9F8g0zt4 XkY+FsID0awv2oODb4CXnCmAe4j1PkXTRhKw0asuRC98Nir7BKCeCP+nf1rbnlqm36xd n7jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="dVps9L/l"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si3659916ejx.486.2020.08.06.11.59.17; Thu, 06 Aug 2020 11:59:39 -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; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="dVps9L/l"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727985AbgHFS4f (ORCPT + 99 others); Thu, 6 Aug 2020 14:56:35 -0400 Received: from mout.gmx.net ([212.227.15.18]:49101 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725272AbgHFS4f (ORCPT ); Thu, 6 Aug 2020 14:56:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1596740190; bh=O7v18ExidfkwJC6p34t30rewB3wUcTv/9gRo5304iiI=; h=X-UI-Sender-Class:From:To:Subject:Date; b=dVps9L/lW17kPLwPVODDzPnOWmy2BFbLqE6Mvr228WmwIukZl74RdQds+V+Wi++Ih YpS+PL9k7txNrkvkJ17EjFPEE35+t8unMC+bq8UfoSmhJwiqYZwjupjZT7xLt8Qh9z +vaV7eSEZ8IIXLSvswzU8y6HciGlp1L4weap+K+c= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([82.19.195.159]) by mail.gmx.com (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MTiPv-1k9VoZ1YKL-00U5fp; Thu, 06 Aug 2020 20:56:30 +0200 From: Alex Dewar To: "Michael S. Tsirkin" , Jason Wang , Parav Pandit , Eli Cohen , Alex Dewar , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH] vdpa/mlx5: Fix uninitialised variable in core/mr.c Date: Thu, 6 Aug 2020 19:56:15 +0100 Message-Id: <20200806185625.67344-1-alex.dewar@gmx.co.uk> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:0uJxosol6/FoMK5KDsqDZ5rimjr7lf6kRU2xNc+U9+4nqEeTbGN FcImhdy1q29bJXvqBPZ5ByLNvQ0qKlRwh+erHhPdGiZbSPrzQowWTrfAhX/3DBbRZZaa+LO 0/xn6XMVsBgatSjfiRFbl5FaFBsyFPntJW4nAXpuK6Df/8jBBmbcnwJHAnsx9faYUhsJUww Y6ochxXEdmJASY2ykMP+g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:xg4rK1+aOZw=:ebkDZlzoeQFyzbfKmBAo/X kMFxmf5DUZfRh0bKT/300Vwmxur+sHO0vF1RlUhxN4n3K/QjZZOMSMLFREuYTgeJtUF/P100O l0IW5hek82pQQUWIMxC0XeqcvEli/kSmlqxvyWuJK7AvrlaZiS2SawnzdNX8sNc6srCQSR/nQ 0FpFk9W4nAvitjJVawqUdYQR0x5wP3J5CifYlO2S/RYALa4VnwwQDhjiRWS6QTw3aavdv6nKY MWjK6H7VPAK0PhIYZ8NC0/t8yAii+Oz2QSGSCom7nQ4iPrmODThDu3EdR5KntZk7FpSZ6XmT3 ELo0ofyvKwHLuoqw27nWNPPIdMyafdnQCb3/d6rDo8VQ3q6JHhMV0/eWAIlBiNqbSl+Layqp0 9dLrXpMaaGw+aAj6HPNnhsJRVxZW9gFnFTNV8ikYCsVd9m3xrwp3pKUX0ldNNSpgIqV+8V5uQ btUq0d74Pu43K/ZqWgR9WMOYHlqvbVQWUidz9p31n7KYfgItsaiovW0EkzYa7YobNmTkNzaai mvwyfcxC9cYka40eSBSVlN3ECa2RrrZEWF9Kduh1i6ki9YBZaHiOJwznSUQ42G3psE1uCUXEU p78oI77VlHALVQpOS7B35+ccSwZXQ7VgbSFlt9XQI2DvsKjhuZH1izIVBYZ6EIAIO8C4ZX84s jvMCUdQeFdvYoi4kLjEiwR5fXHmNEbTP50u5MlmUNyCtPbTxGAmpkOh1BR0BxsFz+TFo7w9Uu 5f+c2ngeL2vCD60LAyzuQ05gRfNwQGsmOaZwn4NMTYKynywQwDdt03thqjcIziPiQr63nbd6Z NbDYWlmGNAA//S2Jl6FoFtCcMowTovwtcREMRX4AVOAGuir4Pu1pCVguAqJoqBj/Ztj2zARSJ N0vk+TWqowB36G8jwIZUYmCb3+3qiP5+GmUUcovqvGDFUlPDlKJp5+9crKIXxJ1uo2U9DJS2P v1GwqsYmwaGn8aZ1IVXtWqwCJOUl5IJh4phbc+WleHPyN0FDi+K5wuyV19oRaDb20LtOIljXP XMd40EQ9Ghoahu5iWRMur4sMfa7N2B4KHXpQAlC4RP5C6Urd83HSzc2T/28jBtzA7Xk+G04pt NUmXVhBMwHJKLq+LaCaFBcvRUC+Wbwl//HWmZaSOoWJtvxQrvf8YeBgpCZ4t245Dudxx2Esj+ egXHEOszLUNXv7kNDy3QcqW5sbxE2ScW1gOIG7ci3tkuf6guJ4x2f77z4KaZZbFqDFpL0WZZt KFWUHglwksgyBTimep1XMRSkyrhwozxiAR1sHWg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the kernel is unable to allocate memory for the variable dmr then err will be returned without being set. Set err to -ENOMEM in this case. Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code") Addresses-Coverity: ("Uninitialized variables") Signed-off-by: Alex Dewar =2D-- drivers/vdpa/mlx5/core/mr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c index f5dec0274133..ef1c550f8266 100644 =2D-- a/drivers/vdpa/mlx5/core/mr.c +++ b/drivers/vdpa/mlx5/core/mr.c @@ -319,8 +319,10 @@ static int add_direct_chain(struct mlx5_vdpa_dev *mvd= ev, u64 start, u64 size, u8 while (size) { sz =3D (u32)min_t(u64, MAX_KLM_SIZE, size); dmr =3D kzalloc(sizeof(*dmr), GFP_KERNEL); - if (!dmr) + if (!dmr) { + err =3D -ENOMEM; goto err_alloc; + } dmr->start =3D st; dmr->end =3D st + sz; =2D- 2.28.0