Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2712671pxv; Sun, 11 Jul 2021 23:32:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUTj/CS/cPFYFiYmo19iU9cjKwIVYvR9TwtcQ7K6+dF2pHY8xBvXNhoUW0fdkYQVEbWmKh X-Received: by 2002:a05:6402:5193:: with SMTP id q19mr64453456edd.258.1626071523083; Sun, 11 Jul 2021 23:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626071523; cv=none; d=google.com; s=arc-20160816; b=eQo+eivKvaPYAgRe9lEmgrfMGFkbcao4OYeyu/y0Tlv9Kl5/SyBo/F+nLfmrRmRSBq OEqhfUvMRszlReWWB/NdIZSZXSz4zibfHE54TjmSyfcLpxzHPFql9SxqplwWqan/ZnvE VPpPRw4XM/wRZNchRUokfPoK/xI1z35a/gx7T7z/lUJNiLRcPAaetIWLIDcHgxer5XdT hrvWnNWYK4g6P9LtERVfiGvhXcNsmUNu6Df0b8g+8PY6pxa5FoNNYzF1uj4UjweyRZjf AUOhIcDpagvVojZx3f7f9JJEE7rimYP/I/eJIURJ/CEyz4LR09ZKfYpjC0wiq/aagwIC 9DXA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NM68p+feinJTEulBZtbK4RXRrPZM7HSUjuq3MSZt4bE=; b=vNiHkNNb5w5K3tS1uLaKWH6o6GSSPFmOKbfJSQ3HIg5+IezobnkVqBg8SkoTs0bqDw DHQOlGQ+wcsmhr+qxm/inuQ8xaIRWoRPEvP457UX08HG3oyMiVgqSlyUqFAmKpYZ/jtR JxGSgV2ZbwMSZSufLGFpN9ja8Owkf9To4/v557Tugkx02h0E72HtpcBtxNo5QAMLJIsC oKFJWlABl0hWcg0e0mI6/UMHt/ALAjDgB8Rw7aPBagJa5/th59TKyjxZ68VJcxY6Gxg9 jjK6YiSTZQSxF9Vg2qpkTWa85EmqHupi1EEMmLWWCKrDZv8KLzid33bpfHHdF3awO2NU DRUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fjOIBhDN; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si19486930ejb.600.2021.07.11.23.31.40; Sun, 11 Jul 2021 23:32:03 -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=@linuxfoundation.org header.s=korg header.b=fjOIBhDN; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236922AbhGLGdf (ORCPT + 99 others); Mon, 12 Jul 2021 02:33:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:47330 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235998AbhGLG3l (ORCPT ); Mon, 12 Jul 2021 02:29:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0BBE060234; Mon, 12 Jul 2021 06:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071200; bh=YS150Zw3EMrfbg7HTU/kACgheRdPjXylbhg3QzhH4fA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fjOIBhDNR9493xej6xLRUe3SNLUp2BXP8JRvhjPUdzelCarEDY7e2qWfcNyT79VlS WOcFquuqWZIdDIzD81q9b/d3daR+RFvav3cXXij0VwNkBMvfW2id+F9YOeA00C0Cpt Xm6U0bvUZl03GCgIJpQCnptgVi62pQpVG+2H3TB8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Zhen Lei , Sasha Levin Subject: [PATCH 5.4 300/348] visorbus: fix error return code in visorchipset_init() Date: Mon, 12 Jul 2021 08:11:24 +0200 Message-Id: <20210712060743.422675456@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060659.886176320@linuxfoundation.org> References: <20210712060659.886176320@linuxfoundation.org> User-Agent: quilt/0.66 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: Zhen Lei [ Upstream commit ce52ec5beecc1079c251f60e3973b3758f60eb59 ] Commit 1366a3db3dcf ("staging: unisys: visorbus: visorchipset_init clean up gotos") assigns the initial value -ENODEV to the local variable 'err', and the first several error branches will return this value after "goto error". But commit f1f537c2e7f5 ("staging: unisys: visorbus: Consolidate controlvm channel creation.") overwrites 'err' in the middle of the way. As a result, some error branches do not successfully return the initial value -ENODEV of 'err', but return 0. In addition, when kzalloc() fails, -ENOMEM should be returned instead of -ENODEV. Fixes: f1f537c2e7f5 ("staging: unisys: visorbus: Consolidate controlvm channel creation.") Reported-by: Hulk Robot Signed-off-by: Zhen Lei Link: https://lore.kernel.org/r/20210528082614.9337-1-thunder.leizhen@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/visorbus/visorchipset.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/visorbus/visorchipset.c b/drivers/visorbus/visorchipset.c index cb1eb7e05f87..5668cad86e37 100644 --- a/drivers/visorbus/visorchipset.c +++ b/drivers/visorbus/visorchipset.c @@ -1561,7 +1561,7 @@ schedule_out: static int visorchipset_init(struct acpi_device *acpi_device) { - int err = -ENODEV; + int err = -ENOMEM; struct visorchannel *controlvm_channel; chipset_dev = kzalloc(sizeof(*chipset_dev), GFP_KERNEL); @@ -1584,8 +1584,10 @@ static int visorchipset_init(struct acpi_device *acpi_device) "controlvm", sizeof(struct visor_controlvm_channel), VISOR_CONTROLVM_CHANNEL_VERSIONID, - VISOR_CHANNEL_SIGNATURE)) + VISOR_CHANNEL_SIGNATURE)) { + err = -ENODEV; goto error_delete_groups; + } /* if booting in a crash kernel */ if (is_kdump_kernel()) INIT_DELAYED_WORK(&chipset_dev->periodic_controlvm_work, -- 2.30.2