vt: initialize con_driver->node in con_init
PATCH 1/1 vt: initialize con_driver->node in con_init
Commit 6db4063c5b72b46e9793b0f141a7a3984ac6facf ("[PATCH] VT binding: Add sysfs control to the VT layer") add node item into struct con_driver.
This patch initialize con_driver->node in con_init.
--- drivers/tty/vt/vt.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/vt/vt.c +1 -0
@@ -2879,6 +2879,7 @@ static int __init con_init(void)if (con_driver->con ==NULL ) { con_driver->con = conswitchp; con_driver->desc = display_desc; + con_driver->node = i; con_driver->flag =CON_DRIVER_FLAG_INIT ; con_driver->first =0 ; con_driver->last =MAX_NR_CONSOLES -1 ;
Signature · 1 line
1.8.3.4.8.g69490f3.dirty
Greg KH
maintainerQuoted 3 lines · Wang YanQing
Commit
6db4063c5b72b46e9793b0f141a7a3984ac6facf("[PATCH] VT binding: Add sysfs control to the VT layer") add node item into structcon_driver.
That patch was from 2006. Why is this change needed now, what problems happen without your fix below?
thanks,
greg k-h
Quoted 22 lines
This patch initialize
con_driver->nodeincon_init.Signed-off-by Wang YanQing <[email protected]>--- drivers/tty/vt/vt.c | 1 + 1 file changed, 1 insertion(+)drivers/tty/vt/vt.c +1
-0@@ -2879,6 +2879,7 @@ static int __init con_init(void)if (con_driver->con ==NULL ) { con_driver->con = conswitchp; con_driver->desc = display_desc; + con_driver->node = i; con_driver->flag =CON_DRIVER_FLAG_INIT ; con_driver->first =0 ; con_driver->last =MAX_NR_CONSOLES -1 ;Signature · 1 line
1.8.3.4.8.g69490f3.dirty
Greg KH
maintainerQuoted 3 lines · Wang YanQing
Commit
6db4063c5b72b46e9793b0f141a7a3984ac6facf("[PATCH] VT binding: Add sysfs control to the VT layer") add node item into structcon_driver.
That commit was almost a decade ago, is this patch really needed?
Quoted 1 line
This patch initialize
con_driver->nodeincon_init.
You are saying what it does, not _why_ it is needed or why this change is happening.
Please rewrite this with more information because as-is, I have no idea why I should accept this patch.
thanks,
greg k-h
Quoted 7 lines · Greg KH
Quoted 3 lines · Wang YanQing
Commit
6db4063c5b72b46e9793b0f141a7a3984ac6facf("[PATCH] VT binding: Add sysfs control to the VT layer") add node item into structcon_driver.That commit was almost a decade ago, is this patch really needed?
Quoted 7 lines
Quoted 1 line
This patch initialize
con_driver->nodeincon_init.You are saying what it does, not _why_ it is needed or why this change is happening.
Please rewrite this with more information because as-is, I have no idea why I should accept this patch.
This patch meet the same situation with another patch I sended ("[PATCH v2]vt: fix potential dual con_driver register for conswitchp"), if conswitchp in con_init is always the first con_driver we register, then no problem will happen due to node will be initialized to zero.
But if it isn't the first, we get trouble due to use uninitialized value of con_driver->node.
At least the code in con_init is not perfect, if we make sure con_driver is always the first con_driver, then we don't need for(;;), just use registered_con_driver[0] is enough.
Ok, if this two patches really don't fix any problem, it will protect you from seeing *the same uselss patches* in your inbox again at least I think:).
Thanks.