Skip to contentSkip to conversation

vfs: init/main.c: change comment: opening /dev/console may fail

PATCH Superseded Askar Safin 2 participants 3 messages Apr 6 – Apr 7

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfs: init/main.c: change comment: opening /dev/console may fail

This patch is for VFS.

Today comment on console_on_rootfs says that opening /dev/console never fails. This is false. The opening may fail if /dev/console is not present in internal initramfs. So let's update the comment.

I tried to fix the problem itself in [1], but the patchset was rejected, so I will fix the comment instead. :)

---
 init/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
init/main.c +4 -1
index 1cb395dd9..40cfda9aa 100644
@@ -1645,7 +1645,10 @@ static int __ref kernel_init(void *unused)
 	      "See Linux Documentation/admin-guide/init.rst for guidance.");
 }
 
-/* Open /dev/console, for stdin/stdout/stderr, this should never fail */
+/*
+ * Open /dev/console, for stdin/stdout/stderr, this may fail if you supplied
+ * your own internal initramfs without /dev/console
+ */
 void __init console_on_rootfs(void)
 {
 	struct file *file = filp_open("/dev/console", O_RDWR, 0);

base-commit: 591cd656a1bf5ea94a222af5ef2ee76df029c1d2 (mainline)

Signature · 1 line
2.47.3
maintainer
#1 lore raw

init/main.c static int __ref kernel_init(void *unused) · line 1650

Quoted 4 lines · Askar Safin
init/main.c +3 -1
-/* Open /dev/console, for stdin/stdout/stderr, this should never fail */
+/*
+ * Open /dev/console, for stdin/stdout/stderr, this may fail if you supplied
+ * your own internal initramfs without /dev/console

ITYM "so if you supply your own internal initramfs, make sure /dev/console is there"

#2 lore raw

Al Viro <[email protected]>:

Quoted 1 line

ITYM "so if you supply your own internal initramfs, make sure /dev/console is there"

I want to write browser extension for expanding your acronyms like "ITYM".

Okay, I will fix in the next version.

Signature · 1 line
Askar Safin