Re: [PATCH] kernel/exit.c: pointer sighand could be uninitialized

From: Al Viro
Date: Thu May 03 2018 - 01:07:04 EST


On Wed, May 02, 2018 at 06:48:57PM -0700, Yizhuo Zhai wrote:
> Variable 'sighand' could be uninitialized if probe_kernel_address fails
> (-EFAULT). The later use in the if statement may lead to undefined behavior.

Excuse me, but that's nonsense. The value *copied* into it (in case
probe_kernel_address() has not failed) may be just as uninitialized.
If mere "compare uninitialized pointer value to NULL" can cause nasal demons to fly,
* we are screwed anyway
* the piece of crap compiler should be printed on sandpaper and used to
polish its authors.

Read the comments in there, please. Especially the one regarding the second case.