From patchwork Mon Jul 12 06:11:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 472862 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2648045jao; Sun, 11 Jul 2021 23:30:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCBFBDf186B/CR7vtajWIM5JghRbXy4+3bs1gkv5UUEAdePDts5vh1lfUCv9r2/XxBLhK/ X-Received: by 2002:a17:906:a019:: with SMTP id p25mr50896281ejy.483.1626071408757; Sun, 11 Jul 2021 23:30:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626071408; cv=none; d=google.com; s=arc-20160816; b=yi/XBbF3AJnUfY8TKs+R7Z2kNoHpngWH6y3FZid7ALfL/YbUcFVP7IUbv24u9CvLYC 05W4z4ZW/ttqCIwrld4298ZgGKwiR9K39RjD67BAv1f7io6sBKxq1V1izXrvKBqds2Jp NLHNvrySFDDXYTHeapjA2n248RjRTteR0n+cJtSymzuUKKxWqB/YBaezz3n8X1wP2rQ1 hRCdthQhUoU+XKVX5ozbXovrsd5AP3HqF59qUF5jf9HqlgH7ODzApXZvBkR5QjNWI3lA CPjkPlvf55//XbjRGQ7baSrkQ1Atf1e2zFtcGexbcjEq+hJGX6/+Uq/M0IkKRUcO1mK8 n4nQ== 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=ub4Gvko8sa7VsE9hQMNxrpt9jTBao60xC2PL75jWOI3UsMMPnBja2hZJ7e2oKJ6vlq AcSyAQxeChqXBsaEsE+PlwLt0nPCiBVRoCwuaSU6f8tTg1XTyx4J4Qnqao/5zQ00YTmo 4215QfHGiIJH8VvDzhNFSVbTGdB/JxfGLW1f58I9w5fGHg5QWfkH4FB0+hXClHqHWV6u cMUHz0BxwlsrPbrpdnjzoqvHN3cDaoPyoS6LBn+K+d/xw47DdR2SvzEPFnFFRPGvGOuN 51UYXtibc1cE4QPt7igfa1pq2t2SbJ/2QyxaAi/odPrRZJOLM05leLsAa/WdUKJCAsLx qVUA== 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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 bz6si16420285ejc.610.2021.07.11.23.30.08; Sun, 11 Jul 2021 23:30:08 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S235265AbhGLGa5 (ORCPT + 12 others); Mon, 12 Jul 2021 02:30:57 -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 Precedence: bulk List-ID: X-Mailing-List: stable@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(-) -- 2.30.2 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,