Message ID | 20230511105845.299859-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4305015vqo; Thu, 11 May 2023 04:51:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Ud2xJMylB6NxbIoJnB4t6qAtJiLMMp1r92wWowU1D+akR6gYFDVl+SRHosMqlEKrI2wTa X-Received: by 2002:a05:6a20:4426:b0:100:24d7:545b with SMTP id ce38-20020a056a20442600b0010024d7545bmr19970376pzb.10.1683805877942; Thu, 11 May 2023 04:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683805877; cv=none; d=google.com; s=arc-20160816; b=xmaSQ73dqJXJAaf8W0AjgokIRlF4/FNGmr4TUYHjZlIdVSYGGS839Yu7TrT8PefqGj u6PD81SyerHdlKdisam4GgSIFD3XgEafJqk1E1d0DnTy2fQSwLOVq2MOd+JRpEZUxtdo QqbwoDLiLMSIkITJ2Jm3czckrhdls++WgaLusaRc+pztD5u4wKohz+62UljA+CJj40uw YO6AG642abIg07/UEMyYwaL4/2TX0y0F2G94nBhV4+kznm5iJqDUanFLbBozafPWCAV/ S9EZXESmg27BIxMx6v/v8K19P0imEdytFfI+4HB1w/PnulBqQPYja65KJsyhZIWYjSv3 39Kw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=0bDsCvCK82DCtmpRSLYrOcmJDrLT69AQ487OJmvhFJU=; b=JMzqhdeV7ZljS33TefrWeKqMGbBqiY9RFjm81hy0fAM3SjC1VK1XNhordxk8X1WdWK FNb0AJHLSN2Nv/N1TrrNOoxEpb6+nt49/1xNVWHnyTTs6V9nJ/bha+9KtWUSjndOsbRG 5BgEBYvAXwm7gkpQ0NScNuzMHQtqR6g22akDU+qI5u8sCpuImegLo2KbGkUWamgbLkJd RGNJa+3SKkBuCfG4m72EgibPMVauq+xhBO/feUP+yJLeyuLXFq4ZCc4J20iUp/Ay/rh5 ki0j0K/9iCeb6LR88SeyyDYMQhtGfvbE2WzoF9c4lvrHfsFMeKEf5iD9e0FfYreGCo4E T5iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CEjFQMdf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f29-20020a63381d000000b0052c8dda0f66si6761639pga.161.2023.05.11.04.51.02; Thu, 11 May 2023 04:51:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CEjFQMdf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237771AbjEKK6z (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Thu, 11 May 2023 06:58:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237235AbjEKK6x (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 11 May 2023 06:58:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 031DAFA; Thu, 11 May 2023 03:58:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 88AFF64C3A; Thu, 11 May 2023 10:58:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2170EC433D2; Thu, 11 May 2023 10:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683802731; bh=qcDiAjFqWhhByq5JwWK2mEEaI3nzFryjK7tJr89pp7Q=; h=From:To:Cc:Subject:Date:From; b=CEjFQMdf7Jj+aStt5qyHlb4JjvgF+r2KsnPRRnT92mEJ4Ql/TTUFxzxMdp5u/oYwq YbNCifcWA4EGsPuxb5BcydH8k29bN+7DjmaWWQ5MHQahMZ5/S6uiBlTBbAlTgCg/BK dpm0O8SxJ4p3e/MDSHE9yevb67H1r5plm8qSDW391Nru2bqFI1RYQl7w7hkhA9FZLr TaZtL4XuIwtpS/VvLVYyF4cw6mc+F78sxLVVwxozf2xj8jwYOpSdOdexjwIDtzfUF7 f4QiQ3aGJWcA6Y4PutrmGEdiRHDzkZCA1PikycZdA/1trPHaWnq9cP886iHxA5kahq 6c+/3EBqQJLOQ== From: Arnd Bergmann <arnd@kernel.org> To: Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de>, stable@vger.kernel.org, kernel test robot <lkp@intel.com>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, Robert Jarzmik <robert.jarzmik@free.fr>, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] clk: pxa: fix NULL pointer dereference in pxa3xx_clk_update_accr Date: Thu, 11 May 2023 12:58:33 +0200 Message-Id: <20230511105845.299859-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765598432122281712?= X-GMAIL-MSGID: =?utf-8?q?1765598432122281712?= |
Series |
clk: pxa: fix NULL pointer dereference in pxa3xx_clk_update_accr
|
|
Commit Message
Arnd Bergmann
May 11, 2023, 10:58 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de> sparse points out an embarrasing bug in an older patch of mine, which uses the register offset instead of an __iomem pointer: drivers/clk/pxa/clk-pxa3xx.c:167:9: sparse: sparse: Using plain integer as NULL pointer Unlike sparse, gcc and clang ignore this bug and fail to warn because a literal '0' is considered a valid representation of a NULL pointer. Fixes: 3c816d950a49 ("ARM: pxa: move clk register definitions to driver") Cc: stable@vger.kernel.org Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/oe-kbuild-all/202305111301.RAHohdob-lkp@intel.com/ Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/clk/pxa/clk-pxa3xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Quoting Arnd Bergmann (2023-05-11 03:58:33) > From: Arnd Bergmann <arnd@arndb.de> > > sparse points out an embarrasing bug in an older patch of mine, > which uses the register offset instead of an __iomem pointer: > > drivers/clk/pxa/clk-pxa3xx.c:167:9: sparse: sparse: Using plain integer as NULL pointer > > Unlike sparse, gcc and clang ignore this bug and fail to warn > because a literal '0' is considered a valid representation of > a NULL pointer. > > Fixes: 3c816d950a49 ("ARM: pxa: move clk register definitions to driver") > Cc: stable@vger.kernel.org > Reported-by: kernel test robot <lkp@intel.com> > Link: https://lore.kernel.org/oe-kbuild-all/202305111301.RAHohdob-lkp@intel.com/ > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- Applied to clk-fixes
diff --git a/drivers/clk/pxa/clk-pxa3xx.c b/drivers/clk/pxa/clk-pxa3xx.c index 42958a542662..621e298f101a 100644 --- a/drivers/clk/pxa/clk-pxa3xx.c +++ b/drivers/clk/pxa/clk-pxa3xx.c @@ -164,7 +164,7 @@ void pxa3xx_clk_update_accr(u32 disable, u32 enable, u32 xclkcfg, u32 mask) accr &= ~disable; accr |= enable; - writel(accr, ACCR); + writel(accr, clk_regs + ACCR); if (xclkcfg) __asm__("mcr p14, 0, %0, c6, c0, 0\n" : : "r"(xclkcfg));