Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9186129pxu; Mon, 28 Dec 2020 08:44:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJycT+X1JDcqNYH+uz/SHwQuD4g1R98vWklH/nerV3tf8/3D0i3m4/aSpel3QkC+wct3hZmT X-Received: by 2002:a17:906:39d5:: with SMTP id i21mr40858287eje.339.1609173866720; Mon, 28 Dec 2020 08:44:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173866; cv=none; d=google.com; s=arc-20160816; b=d1Mcf34Cjci69vQF+qQuemSZyBUzbn2kO8ckPvxy19hkVC8xdnfTzE7xHPiQcocCSe +CNGW/EzxH1APypzy7MzJyIWGIuNPElb7PYYjvH0Kiom08RCrngsq2CnasOf3t6Na6xm TjOa1K7wA40lXC+rpAldoCayMtO20cRtsqlXQHCND6ktmjMI+yxOM1ROd6GBTVCskhg6 ovLhfkLWS4Yy6QM3eIGUhRnoJC92TTKA9zyy/W2uz3NLRp7gw8KumbCbpi6kOPB5aAvu 5i5R+Lukq5OTIzfPHlslWH3BtV5/GaRMjAk5z6cNNAofyb3SK2R7utK7tEEdz8cioRkb q7aw== 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=gh0WXcGdZEz4tPdH5+DnOW87P/9N+DuDBb4gPMKFa6Q=; b=vnT8olVF4oHJQk0IOnlHqcZBKTts2+7i7QMjGxBuW/3q1XzFUjsXrT/SqtvcykgDgB eWZG3J1YhXH0OXX6iN8/EYMORWb58C7aD1VkEquissVYrLlojYxucMZIOp4iNMwuh9mQ TSA+lKRjuEC+HksC1L1DKrxG45YtRFzwJtOJqpKh/A4nQGlnU/KsdoYpW/LmIFgWAZBY jy1a9pXIoQv1eNsoG7H4zbvBdo/xnFoaRaPOx+IH9xpnuAHWDyA7hEEWu+vi6ZCYjhR2 y1CEtsqioLc2GTTYQ4mx1zwQSui6yFPRRlUTxeM4xRlmLwlTkLjCutsKpc8IZEmsqnvu mENA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="d1/0lJ7k"; 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 u17si20609462edo.494.2020.12.28.08.44.03; Mon, 28 Dec 2020 08:44:26 -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="d1/0lJ7k"; 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 S2633821AbgL1QkV (ORCPT + 99 others); Mon, 28 Dec 2020 11:40:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:56000 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729301AbgL1M7p (ORCPT ); Mon, 28 Dec 2020 07:59:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1FF5322B40; Mon, 28 Dec 2020 12:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160344; bh=loO3fcbnZq6yWGDjrMScXV8PinQTGCawLfaIzEjZKRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d1/0lJ7khW5JDArcNFvozaaLdNW/EsJxWlR1lWVxMQLayYsvRzz67VqpbqKGKMxCG G3BYHgE7SwcLixLPXIkpamFwzh0Cn7KZb03uptV97P3mlsCjC53vMCd2pVvPn5i8JS mDvCh2YPzBTuOe9iGPGpE4z5/aVxbmH3pjZjbEbs= 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.9 002/175] spi: bcm2835aux: Restore err assignment in bcm2835aux_spi_probe Date: Mon, 28 Dec 2020 13:47:35 +0100 Message-Id: <20201228124853.349580116@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 @@ -444,8 +444,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);