Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2451691pxb; Mon, 19 Apr 2021 06:10:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjDS4Q7TZBP3rOzY4aF3AFsafifSyiox7Inb3V9kpyyXb5Iv3PGaCnSsG4OxyDaQ7FCZH3 X-Received: by 2002:a05:6402:1a47:: with SMTP id bf7mr13737979edb.173.1618837801156; Mon, 19 Apr 2021 06:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618837801; cv=none; d=google.com; s=arc-20160816; b=WddaQDBx7whAOvOphejcHboUOq/yGJJ7AnWz8GtdSO72zWtfOQv/8XfbcmJUbuF1jL vBzVNGjlhPA49/hdI3WPgZch4kVuaHlQb3XQkIe50vWtdURrD1GX3IXtxWMXjyGsbHTu UmdilTW3EAMXym6CLCbceKrCT+cEf01hkq9E0A7sVOUU2DGp7SDpSC814M0oY0Bb9jWC Hx7k12199tbL9kW4LIw7M4koxw1zE8p+XCLrjkPIRK7kr9PvrNxtXBMRffwNjBXToA4H ya0zywnawzTj6zRbIR5/2bBtkEtSdGkRyE50l0UcrlkAcSKEYpCK7l6XVBlF07X7VOk3 h9ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=fEEZ1OtKhaZdjvyVQah4cIoyf8ODG5qyXZa7vJQyfcQ=; b=TAEPU9KrEaRm2/YVfjr68JQZhEIqksjfDT+Sk5P/+AGde0ajsSY9wFnQZyJ+cSsePi +f0+Iz7KWQGwW/K5oSmXE0WwQPpdDupEqbTD8bBf9HuB+E/0GCfuvRGGonzXCZ/qRUz2 FdSjoC8j9hXH2Z29zHsl1VvYQvY1S1xBc/cEQKsdzExpxfcTUDDEI9Vo+6WWWj3/z20s 4oYVa/RcazmV0h3xH723jCVvzxSVBuLrqvVivSA8iZa7NRLiVvZkZ84NlmgL0KN6Rpqh n8i+7QrfqGHHjcXGgeItyzOUh3JQO730DF7B2ddQqEc9TvxPUbkFa0MSusRkAOKDEMsN o11g== 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 y13si13498319edp.165.2021.04.19.06.09.37; Mon, 19 Apr 2021 06:10:01 -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 S239146AbhDSM5A (ORCPT + 99 others); Mon, 19 Apr 2021 08:57:00 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:58929 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232709AbhDSM47 (ORCPT ); Mon, 19 Apr 2021 08:56:59 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lYTS0-0001Z9-7b; Mon, 19 Apr 2021 12:56:28 +0000 From: Colin King To: Coly Li , Kent Overstreet , Jens Axboe , Jianpeng Ma , linux-bcache@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] bcache: Set error return err to -ENOMEM on allocation failure Date: Mon, 19 Apr 2021 13:56:27 +0100 Message-Id: <20210419125628.177047-1-colin.king@canonical.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King Currently when ns fails to be allocated the error return path returns an uninitialized return code in variable 'err'. Fix this by setting err to -ENOMEM. Addresses-Coverity: ("Uninitialized scalar variable") Fixes: 688330711e9a ("bcache: initialize the nvm pages allocator") Signed-off-by: Colin Ian King --- drivers/md/bcache/nvm-pages.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/bcache/nvm-pages.c b/drivers/md/bcache/nvm-pages.c index 08cd45e90481..2e124d546099 100644 --- a/drivers/md/bcache/nvm-pages.c +++ b/drivers/md/bcache/nvm-pages.c @@ -584,6 +584,7 @@ struct bch_nvm_namespace *bch_register_namespace(const char *dev_path) return ERR_PTR(PTR_ERR(bdev)); } + err = -ENOMEM; ns = kzalloc(sizeof(struct bch_nvm_namespace), GFP_KERNEL); if (!ns) goto bdput; -- 2.30.2