Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9178198pxu; Mon, 28 Dec 2020 08:31:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwD9MUHRdmdyAsGZrHaWMac+OiC4CIltVW5UuJSQvh04twAxqfsI6deu8/LI6nsodxkQ5Pn X-Received: by 2002:a05:6402:22ea:: with SMTP id dn10mr42393093edb.67.1609173085605; Mon, 28 Dec 2020 08:31:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173085; cv=none; d=google.com; s=arc-20160816; b=dRJlvKZfyiB/+7GIQ49QyEDa+VocomLNDg7aSLe8onc5fA0u9wYR0daoHYRnajkxfA DTlzl6y0JseYG2AtIWCHo2iwJY3YbkDEdBl8sK6mR7yQEy2iixid5Ri2h/b/+ZVkUahd WYdAhtSQE/g5V3jErr10zTGB2Z8Qu2Eb9cg5f1IyQuzACIpYG2fI9XP69J4zcccELDez F6wTsMs8BRk3r5XPRdLXf4yYBdT9rp3LW105zrbx/PCEsuCZfOgJBIrxzSTSbiJfTski FYiwlL3a0zqmqQV2EkrdA4mdLWmQ+CNDQLbiVaodV8ki0khF2dIechtsaqUruj2HPsGw q6ZA== 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=iW4/pePvBxMQIMWjkq5oVqaPhp+VtuElMNmG/zQlrjUWO2MEwOtmL0QzCs304Lk2j6 1gM7+xZNDkNWwW3ESz1C27YJrblcvJoY+VZkA1Tciotmo/2/sDlFZ/0+dLoqckvFEr10 cYObRIAJWxVtZiKyvae1+sYmRBeoIAS65xeRZN2EPXNp0JBX4+a/dtuvejJ8qvuFgbMR Ti7cJedy+DZChBWcuP5IYvx66NS0rJIK10QnLnRQeXD1Ly1y3/JqMUxi+T94+pVjocO0 l6YNZP+SVMVMqPzXdfa0L7czy47jOsVkEPWEjYOQufroKKpHFh81aRscmdnALdWPFUMr qBHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D0B34D6O; 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 d11si21286142edv.195.2020.12.28.08.31.02; Mon, 28 Dec 2020 08:31:25 -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=D0B34D6O; 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 S2633551AbgL1Q2b (ORCPT + 99 others); Mon, 28 Dec 2020 11:28:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:34882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730785AbgL1NH0 (ORCPT ); Mon, 28 Dec 2020 08:07:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9BA80208B6; Mon, 28 Dec 2020 13:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160831; bh=loO3fcbnZq6yWGDjrMScXV8PinQTGCawLfaIzEjZKRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D0B34D6O71FmuUMb9luHkAx3dVwncALe0f7ftbopgzJQashAPq1XWiK6sS6sPiYFe KftzII6HCqTRVapnehfV4gOOVBDkq5sxfAggQA+e8wKZpYG56Lqlo1rwaCq28JKfrn g4GTSr3yqqzl4snDrbVcyDu07MNm34MFIjhRfFBs= 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.14 002/242] spi: bcm2835aux: Restore err assignment in bcm2835aux_spi_probe Date: Mon, 28 Dec 2020 13:46:47 +0100 Message-Id: <20201228124904.777640165@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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);