Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4403368rwb; Tue, 20 Sep 2022 13:26:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rqFVJ/2EoS4/Pv56SQ0//MyzdcfGNKiyROwrGDG7LXU4YZgIZGmxRw+z8lveVzODwJmJi X-Received: by 2002:a17:907:c03:b0:781:fd5a:c093 with SMTP id ga3-20020a1709070c0300b00781fd5ac093mr931356ejc.89.1663705569825; Tue, 20 Sep 2022 13:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663705569; cv=none; d=google.com; s=arc-20160816; b=PzI9R97aW/GpJ7OSYSTqDTLDpiGBOY45Snputx8ft/hTzXPV3AqpZHaxXVhWP4DdV/ qwsJQligo4BmTZRNMryqmUgsjwTwsJYp1+NZq66jxutJy0dTQNK80dPuqpdSp7y5dosL hCAXmiP5xh2vC8boIjVbVFNyUt61m+8OGV56mJfQDzadZuIjRLWPM6+ngXl+ngsPCTO/ VkM1KEDKbfaVs6HOh652NtB9xgWRKMiVsZtpbTDLLjFUtDHbN2VhZHO42d9t5DNAyzSf INcRsPgcItmh//ZMdhLUAV8j9LeH794VPffy6MBZT4safxNt1F2y9l3qBp0jyQ/n3mjx AV3g== 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:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=PWUGz0PRvdDOgM0Ab2T3T5nKb6OhR4jChuedE6kRKP8=; b=EprFLD1redbp0GVGd9MCQjoikUDr0rDnWr9a/JM+BOxHm365ygfneisTOORQKfZBWX s/uN2yJ+I4zkkoD7e85r/HwJ5A+TqKXPhdTbLToqzIwtifbqzF5ZDN0PrbOrqej6cLCF WFl1qN+ZrAN4pKdk4GG62n8CUX/m0ZMHNOXFKIKiTw2J04XwviZI0NXRT5MA4La5dgbU iWpJInVctGmTs4mPjxsqN7n6jezwEygEacw5h+IxqIevf3Xa1sVSPnvQZnpxroVwMXpN NxOWFh8i2wUkwLtfP+CFTYJ/cMFs4IeQg1yu2TLsEE3kEGnV8ub6NCbixplWU76Z1BpM MppQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=1NmEbPld; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n5-20020a170906840500b00781df71dbc1si597532ejx.174.2022.09.20.13.25.44; Tue, 20 Sep 2022 13:26:09 -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=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=1NmEbPld; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230368AbiITUGV (ORCPT + 99 others); Tue, 20 Sep 2022 16:06:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229799AbiITUGS (ORCPT ); Tue, 20 Sep 2022 16:06:18 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4C096050E for ; Tue, 20 Sep 2022 13:06:17 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id c198so3726049pfc.13 for ; Tue, 20 Sep 2022 13:06:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date; bh=PWUGz0PRvdDOgM0Ab2T3T5nKb6OhR4jChuedE6kRKP8=; b=1NmEbPldGdjPw8Rivm7tHuXatNUeGxXgwN+BFvLdkXb/XGenizjk7CrWbAonfGj6r5 rJmQVDAULJHCL7f/9yjG2l5N08X3omJks9isCXvo7HYvRqNaQNV+V3rV2vhso3sF1WeG ZoscIP7BMEDgnNmQYIXjsTPMFx07C9a8L2G04wj+tzKEJ6ZI+cGFg3eyWt31UQMipc8r x6bPu+a0xdw6LWvpFNMJ0zPcEJCxraHQl4lU7QoaKYrz4cuU8sazdX/cCrqZyG4m6tU5 EBnbZNQYvPh31kskZbJ19EPKx+aTHC+9QjELV8+cQ4gTfUSDbLu9WBNMi9DyrP4E6ipx koVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date; bh=PWUGz0PRvdDOgM0Ab2T3T5nKb6OhR4jChuedE6kRKP8=; b=TL2MsHAe5lCpdfgX1Lv6D52/UNNycBaun49PHg2vzr875KgyS5//rsKYCSlzSt3/zS LpulcjTTxUehh8ArIM4mu4Xx+7IgOdjyBc9MHSgf4/pyG93lMRWHbD6eMWiosRmmo7OT Jnd2kCFqtWF8nXNPeS9TRXDKhZji5W3ZLDF6ZJj75FhZVSzvPvXbU307XUNl4C9lGsy8 pryjv/BdGCahZf1uiNFv+a6Jzfyboqo2EGr+gYlJABJg2QVQiJTNnd94Du2SUTTnvdSN V7lKC20avl1820N6gVpSYv4hivnBcpMHlWW35gltcUHb1/RbpJNhxVBlN8xLHgkKBq2T RO5A== X-Gm-Message-State: ACrzQf03hnvK75QdgcIeyMIgyF6yfsi7KlVNxbFzVInGMfe9J+W3be+B MWpX7VBrgFp8CJJsc3YmIuywwQ== X-Received: by 2002:a63:9042:0:b0:438:8ef2:2476 with SMTP id a63-20020a639042000000b004388ef22476mr22435404pge.55.1663704377133; Tue, 20 Sep 2022 13:06:17 -0700 (PDT) Received: from localhost (p57a238e9.dip0.t-ipconnect.de. [87.162.56.233]) by smtp.gmail.com with ESMTPSA id c85-20020a621c58000000b0053653c6b9f9sm275804pfc.204.2022.09.20.13.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 13:06:15 -0700 (PDT) Date: Tue, 20 Sep 2022 13:06:15 -0700 (PDT) X-Google-Original-Date: Tue, 20 Sep 2022 13:01:50 PDT (-0700) Subject: Re: arch/riscv/kernel/traps.c:48 die() warn: variable dereferenced before check 'regs' (see line 46) In-Reply-To: CC: dan.carpenter@oracle.com, kbuild@lists.01.org, lkp@intel.com, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, guoren@kernel.org From: Palmer Dabbelt To: xianting.tian@linux.alibaba.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 11 Aug 2022 03:42:28 PDT (-0700), xianting.tian@linux.alibaba.com wrote: > > 在 2022/8/11 下午6:33, Dan Carpenter 写道: >> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master >> head: f41445645ab5d172e6090d00c332c335d8dba337 >> commit: 3f1901110a89b0e2e13adb2ac8d1a7102879ea98 RISC-V: Add fast call path of crash_kexec() >> config: riscv-randconfig-m031-20220810 (https://download.01.org/0day-ci/archive/20220811/202208110538.uaLOQmBs-lkp@intel.com/config) >> compiler: riscv64-linux-gcc (GCC) 12.1.0 >> >> If you fix the issue, kindly add following tag where applicable >> Reported-by: kernel test robot >> Reported-by: Dan Carpenter >> >> smatch warnings: >> arch/riscv/kernel/traps.c:48 die() warn: variable dereferenced before check 'regs' (see line 46) >> >> vim +/regs +48 arch/riscv/kernel/traps.c >> >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 31 void die(struct pt_regs *regs, const char *str) >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 32 { >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 33 static int die_counter; >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 34 int ret; >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 35 >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 36 oops_enter(); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 37 >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 38 spin_lock_irq(&die_lock); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 39 console_verbose(); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 40 bust_spinlocks(1); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 41 >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 42 pr_emerg("%s [#%d]\n", str, ++die_counter); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 43 print_modules(); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 44 show_regs(regs); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 45 >> a4c3733d32a72f Christoph Hellwig 2019-10-28 @46 ret = notify_die(DIE_OOPS, str, regs, 0, regs->cause, SIGSEGV); >> ^^^^^^^^^^^ >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 47 >> 3f1901110a89b0 Xianting Tian 2022-06-06 @48 if (regs && kexec_should_crash(current)) >> ^^^^ >> >> Delete this NULL check. > thanks,  I will send another fixup patch to fix the issue, is it OK? You're always welcome to send fixes, but I didn't see anything so I just sent along https://lore.kernel.org/r/20220920200037.6727-1-palmer@rivosinc.com/ >> >> 3f1901110a89b0 Xianting Tian 2022-06-06 49 crash_kexec(regs); >> 3f1901110a89b0 Xianting Tian 2022-06-06 50 >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 51 bust_spinlocks(0); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 52 add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 53 spin_unlock_irq(&die_lock); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 54 oops_exit(); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 55 >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 56 if (in_interrupt()) >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 57 panic("Fatal exception in interrupt"); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 58 if (panic_on_oops) >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 59 panic("Fatal exception"); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 60 if (ret != NOTIFY_STOP) >> 0e25498f8cd43c Eric W. Biederman 2021-06-28 61 make_task_dead(SIGSEGV); >> 76d2a0493a17d4 Palmer Dabbelt 2017-07-10 62 } >>