The comment says "this should never fail", but it definitely can fail
when you have odd initial boot filesystems, or kernel configurations.
So get the error handling right: filp_open() returns an error pointer.
Reported-by: Jesse Barnes <jsbarnes@google.com>
Reported-by: youling 257 <youling257@gmail.com>
Fixes:
8243186f0cc7 ("fs: remove ksys_dup()")
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/* Open /dev/console in kernelspace, this should never fail */
file = filp_open("/dev/console", O_RDWR, 0);
- if (!file)
+ if (IS_ERR(file))
goto err_out;
/* create stdin/stdout/stderr, this should never fail */