Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9192798pxu; Mon, 28 Dec 2020 08:55:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrJViSK8lhxNyx1LN4bdqe9wXiYgY4ww00MQmoHHX1T6B0XbvXRtyLI1PFaKteR/8I6161 X-Received: by 2002:a05:6402:1592:: with SMTP id c18mr42225726edv.181.1609174540676; Mon, 28 Dec 2020 08:55:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609174540; cv=none; d=google.com; s=arc-20160816; b=yevAxOhrxnunDVAam/WL3WiGXzAWspnSwhGvJCsg3AfIOaRViZOsycRvyV6UhvpVj9 IjRyetpcBDAVJ+IKxxAJV6L7UBt2WLK0A+lE9Z3k4TI8nOquJVWwhEc4I9mhNw++5nNU ZDvgOWQe4wOCnRdgN53h7q7BWOiqGYhMVE93201BZxrraoOkba6n3v+pQ2dBbKzmYLqZ NIl+r7tF1Sv5+PTBV62qAhSKkTdmWFYglL44Pb407aZkbwwFwXxk9JfNeUzjKprdUxsH aUNunGkTvBzVw/Sj4PtUo4GI62t3GFTsOu6VGF4Vw9354sdDkkOqTxJ5vR4+9mvo04by poNg== 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=7r9hZ7tJzCog5ZGm/Ss4mpVFxqUcDVI8kTBJWKGUqB0=; b=SvceUnlDhOKEh/MMtwsczQwWHsJGPL9Fvf9HOEYEucrOU67DFxBEbdNsiIbqYuE+lz nZQUdQYBaEFp/uga/0uR2lzrhf9zRNJdYdlVfNA8yD8pUzBpUqSVm3FEpSFh2/Pw/87Y gNP89TvLr/WHVdSUElm16+VTR6THuOtPEjKIUwymWJu/KemzYzZrQcIk1kmrO6etosNv w4XkIbV8P/LASC+8HqRsN1kscSU9rfmvb/4CUEhS8c5Qm8dOb83bnTDyC/agoGgA0E2y etrSLa4vLzHZM878BwjHrOCLfkuYTULE4fk5KefcHutgy2aGnOP3RQit/BbAtIMIgqwZ RFDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q9nOLWmW; 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 qh13si18768200ejb.440.2020.12.28.08.55.17; Mon, 28 Dec 2020 08:55:40 -0800 (PST) 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=q9nOLWmW; 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 S1728005AbgL1Mw4 (ORCPT + 99 others); Mon, 28 Dec 2020 07:52:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:49820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727994AbgL1Mwz (ORCPT ); Mon, 28 Dec 2020 07:52:55 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 04021229C6; Mon, 28 Dec 2020 12:51:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609159915; bh=m17xW3VM15KVS2s8C5E4GEW6nQag9CrdQWXtRVV2uOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q9nOLWmW7wEZeszjPKSlzPnMt9wsAxXUCSyk7oexki2q3rFwPA7zhh7IYPSUdyjn9 k1T6JpP/SoDjBMk6WxIl8JQi431qVh4OL27yaOdw+zvCPSoXzh9OQfbq6hDTNc4CjG aZbHJbIr44l0EhlY8QdtJgbVELRa727Saar1zu9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Mark Brown , Lukas Wunner Subject: [PATCH 4.4 002/132] spi: bcm2835aux: Restore err assignment in bcm2835aux_spi_probe Date: Mon, 28 Dec 2020 13:48:06 +0100 Message-Id: <20201228124846.541065310@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124846.409999325@linuxfoundation.org> References: <20201228124846.409999325@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: Nathan Chancellor [ Upstream commit d853b3406903a7dc5b14eb5bada3e8cd677f66a2 ] Clang warns: drivers/spi/spi-bcm2835aux.c:532:50: warning: variable 'err' is uninitialized when used here [-Wuninitialized] dev_err(&pdev->dev, "could not get clk: %d\n", err); ^~~ ./include/linux/dev_printk.h:112:32: note: expanded from macro 'dev_err' _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~~~ drivers/spi/spi-bcm2835aux.c:495:9: note: initialize the variable 'err' to silence this warning int err; ^ = 0 1 warning generated. Restore the assignment so that the error value can be used in the dev_err statement and there is no uninitialized memory being leaked. Fixes: e13ee6cc4781 ("spi: bcm2835aux: Fix use-after-free on unbind") Link: https://github.com/ClangBuiltLinux/linux/issues/1199 Signed-off-by: Nathan Chancellor Link: https://lore.kernel.org/r/20201113180701.455541-1-natechancellor@gmail.com Signed-off-by: Mark Brown [lukas: backport to 4.19-stable, add stable designation] Signed-off-by: Lukas Wunner Cc: # v4.4+: e13ee6cc4781: spi: bcm2835aux: Fix use-after-free on unbind Cc: # v4.4+ Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-bcm2835aux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/spi/spi-bcm2835aux.c +++ b/drivers/spi/spi-bcm2835aux.c @@ -416,8 +416,9 @@ static int bcm2835aux_spi_probe(struct p bs->clk = devm_clk_get(&pdev->dev, NULL); if ((!bs->clk) || (IS_ERR(bs->clk))) { + err = PTR_ERR(bs->clk); dev_err(&pdev->dev, "could not get clk: %d\n", err); - return PTR_ERR(bs->clk); + return err; } bs->irq = platform_get_irq(pdev, 0);