Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2343401imm; Mon, 28 May 2018 06:25:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoNqNKzxFSDPliVxOzPvrpMpeGyvbC7xb+4IAPw75N6OCsqh52QQlQIP7raaZ6RctqIhw/D X-Received: by 2002:aa7:810f:: with SMTP id b15-v6mr13330440pfi.79.1527513900287; Mon, 28 May 2018 06:25:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527513900; cv=none; d=google.com; s=arc-20160816; b=WlPf6vR/JQ+ar7G1FEJRzd2YnyjdqvIib8JEUVdn956Mjol3cpQarPO2J1MCdMW89a sKzsCPS698dB1akhW+BG0HYhviG/eoxGAjDk/WBEgSrs9m/rjkS6TYqNrWjR7cHQIHKI RFyo95eOYw0tRSV0p+Eg9912pcTNI8EW+8lQRNmE09SeFdbjcp4sQJMRMvwlvr4uZgC5 K2HA4oqd7VB4XkENCPxqYdxm5n4CCUnrjSzDZVpdjU8Uhu4YHsA7zFXy8Gkd2DJ/eMhv gmFO7uFMb0DXMokCEiOYDGdMFBsE/EHlwmvqcDkLYaUXT4JyAsviZGo3wDrN0hJAZGAU kJPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=EAcYET+7KeQV+bn5/QamyKe0EcsnzG1HYWV0uKhrmyY=; b=itWJk2CYmLlyFqCfSYFTUOKP5KUQI8XFxWeQ33mz77l3GupUlCJltKhaAaeFeQXx9F JBQlb6HARTTzHKPzC2zjz99o/9Ys1HH4MB7LCo4dSk8p7eTKcp7K9zQwhBGtcwY2W0tR mBf4ecYnSGdKTdqi8epCZFipwI90P8BATiJORpTG91fH98/+D0dftxrDP3Z7uODCa+dk sYejiXO7vVpftB1NF0PG+Uk60ol7/KWdz7EC6pRi+kIlLH1LmfHGCnlOWpPXKFaz+Qxq X8dL7VjPNvVf3VhHzMC/pYqiq91wIFVySp7bHKyDoIr2VNPtZBAb7Tq7fONDdKNvUQER 2f9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LJmutar6; 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 l13-v6si612940pgf.629.2018.05.28.06.24.45; Mon, 28 May 2018 06:25:00 -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=@kernel.org header.s=default header.b=LJmutar6; 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 S1425056AbeE1NYB (ORCPT + 99 others); Mon, 28 May 2018 09:24:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:38488 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163222AbeE1Ksg (ORCPT ); Mon, 28 May 2018 06:48:36 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3DDDE20660; Mon, 28 May 2018 10:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504515; bh=3Zl1JOBfZq8OiGQC++8hGXixmkXVCzkyGXLVXupvM44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LJmutar6hOgJX/q0vDdF/FSoQzAfx9J8xKNIY7wY7Zyw6xHQQOOXjbWLxcjFxBVZ9 lQv4Sm1qu4pSqQ3iopjxPcYP+C1euNcgxrU+U71Y09UbWkXFYnOw7sS/oQdt7T+W0m peDZJcjBRrRL6MasH1ofbg+Sq1rC8eXryeIeVFGQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Omar Sandoval , "Gustavo A. R. Silva" , Jens Axboe , Sasha Levin Subject: [PATCH 4.14 166/496] nbd: fix return value in error handling path Date: Mon, 28 May 2018 11:59:11 +0200 Message-Id: <20180528100326.858140919@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Gustavo A. R. Silva" [ Upstream commit 0979962f5490abe75b3e2befb07a564fa0cf631b ] It seems that the proper value to return in this particular case is the one contained into variable new_index instead of ret. Addresses-Coverity-ID: 1465148 ("Copy-paste error") Fixes: e46c7287b1c2 ("nbd: add a basic netlink interface") Reviewed-by: Omar Sandoval Signed-off-by: Gustavo A. R. Silva Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1591,7 +1591,7 @@ again: if (new_index < 0) { mutex_unlock(&nbd_index_mutex); printk(KERN_ERR "nbd: failed to add new device\n"); - return ret; + return new_index; } nbd = idr_find(&nbd_index_idr, new_index); }