]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
um: Fix return value in ubd_init()
authorDuoming Zhou <duoming@zju.edu.cn>
Wed, 6 Mar 2024 09:12:59 +0000 (17:12 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:32:23 +0000 (13:32 +0200)
[ Upstream commit 31a5990ed253a66712d7ddc29c92d297a991fdf2 ]

When kmalloc_array() fails to allocate memory, the ubd_init()
should return -ENOMEM instead of -1. So, fix it.

Fixes: f88f0bdfc32f ("um: UBD Improvements")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/um/drivers/ubd_kern.c

index b12c1b0d3e1d0be92e7c07d1d75207615a4b257c..de28ce711687e8ede7f1d675173fdd3b4332547a 100644 (file)
@@ -1158,7 +1158,7 @@ static int __init ubd_init(void)
 
        if (irq_req_buffer == NULL) {
                printk(KERN_ERR "Failed to initialize ubd buffering\n");
-               return -1;
+               return -ENOMEM;
        }
        io_req_buffer = kmalloc_array(UBD_REQ_BUFFER_SIZE,
                                      sizeof(struct io_thread_req *),
@@ -1169,7 +1169,7 @@ static int __init ubd_init(void)
 
        if (io_req_buffer == NULL) {
                printk(KERN_ERR "Failed to initialize ubd buffering\n");
-               return -1;
+               return -ENOMEM;
        }
        platform_driver_register(&ubd_driver);
        mutex_lock(&ubd_lock);