All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Xianting Tian <xianting.tian@linux.alibaba.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	Palmer Dabbelt <palmer@rivosinc.com>, Guo Ren <guoren@kernel.org>
Subject: arch/riscv/kernel/traps.c:48 die() warn: variable dereferenced before check 'regs' (see line 46)
Date: Thu, 11 Aug 2022 13:33:48 +0300	[thread overview]
Message-ID: <202208110538.uaLOQmBs-lkp@intel.com> (raw)

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 <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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.

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  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: arch/riscv/kernel/traps.c:48 die() warn: variable dereferenced before check 'regs' (see line 46)
Date: Thu, 11 Aug 2022 05:43:45 +0800	[thread overview]
Message-ID: <202208110538.uaLOQmBs-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3459 bytes --]

BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Xianting Tian <xianting.tian@linux.alibaba.com>
CC: Palmer Dabbelt <palmer@rivosinc.com>
CC: Guo Ren <guoren@kernel.org>

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()
date:   3 weeks ago
:::::: branch date: 3 hours ago
:::::: commit date: 3 weeks ago
config: riscv-randconfig-m031-20220810 (https://download.01.org/0day-ci/archive/20220811/202208110538.uaLOQmBs-lkp(a)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 <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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  30  
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))
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  }
76d2a0493a17d4 Palmer Dabbelt    2017-07-10  63  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: arch/riscv/kernel/traps.c:48 die() warn: variable dereferenced before check 'regs' (see line 46)
Date: Thu, 11 Aug 2022 13:33:48 +0300	[thread overview]
Message-ID: <202208110538.uaLOQmBs-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3258 bytes --]

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(a)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 <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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.

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  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

             reply	other threads:[~2022-08-11 10:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10 21:43 kernel test robot [this message]
2022-08-11 10:33 ` arch/riscv/kernel/traps.c:48 die() warn: variable dereferenced before check 'regs' (see line 46) Dan Carpenter
2022-08-11 10:33 ` Dan Carpenter
2022-08-11 10:42 ` Xianting Tian
2022-08-11 10:42   ` Xianting Tian
2022-09-20 20:06   ` Palmer Dabbelt
2022-09-20 20:06     ` Palmer Dabbelt
2022-09-21  1:35     ` Xianting Tian
2022-09-21  1:35       ` Xianting Tian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202208110538.uaLOQmBs-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=guoren@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=palmer@rivosinc.com \
    --cc=xianting.tian@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.