Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp958821lqs; Wed, 6 Mar 2024 01:50:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWPOKeU53bEgDiAuJlZj+v/gZ6Tz0XTfSwpZux9jJjorLooa4SCU74OAf/Hp7Efv9LF92WV97YwYmRobMz8XpRDAbP1ZugU73Hkw7bWYw== X-Google-Smtp-Source: AGHT+IFp0I7A1xnsN1qVvrOrhZt6vMxYuzesoIiU4Lp8kACcCznG7RMR3XJFKJILtN70FPldo10H X-Received: by 2002:a17:903:11d2:b0:1dc:f360:7537 with SMTP id q18-20020a17090311d200b001dcf3607537mr4932333plh.54.1709718658913; Wed, 06 Mar 2024 01:50:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709718658; cv=pass; d=google.com; s=arc-20160816; b=iIlPA+TN4mfTJmkfa6Lf1mhaQUo0ei5o7ldjkya9QPLVtIqeaH4t9Q/U+sa/lYqAzm SwupaHCKTgwEz0r76FOxETv3F5RC1nQJM7w9oG4ShcsL5LhuoYNecKfEr/ziQZb2IbmE C3XGKonozhK5JgPtOHDo13C/2i/7sZAMhu0etetjE45mrVLBexnsA6sycN+x2lQh8d8e iWApNyQgNBnea0D9vhSnekaylYjAReMH96xa4GCU8nwtGNHtKiScOR6uFKVX1Zs7lrlb RYOxYKK67m0a0As1K+7ISFHUxYkPLxNUPXDggt+KGjgq1usuxGd9tAKvaEYOSvu36Cad f4Dw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from; bh=tetrM2/lVoO6b6MoahszNtPEy7BfcDE3luQSqTYJhgU=; fh=kWei/F57MwxUGC1cO6sgir0grfmur38+yQledJW6AXM=; b=mFHrlmgZOdugQjPVWCAhnVZVEtgNFZ1paSCj8LqF6OE6FNbaFI75m1ji3Vd5NYe35O qUArLrDifEtvbqTvaBze5/1Y5gVqExbLDwFx8X+VosiZ3ROdhSpF+Exutky/tWcm2jFE Rf4rpx6FTHphW4jYnbbEvZfWRC7f1yaCta0lHucwTUe1k4Ad88i09ceq2vkkhLVy7Pgo Nuhm3PVQK5wOuSjbZmRQM2DjdXQcVzujajc5UQHC538fV8UReQKmRCbG9VvLIAD7fNye Nm6BW8WI5pjeXkOcBaiqL6My7n8nGlabqGPyr2YWt1w3rm154yV1ZlR7IWV6tyc8Lu1p qXGQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=zju.edu.cn); spf=pass (google.com: domain of linux-kernel+bounces-93602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93602-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id w6-20020a170902e88600b001dcabe5b3absi12025457plg.33.2024.03.06.01.50.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 01:50:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=zju.edu.cn); spf=pass (google.com: domain of linux-kernel+bounces-93602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93602-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 95C11B26CB6 for ; Wed, 6 Mar 2024 09:15:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6EB25F47B; Wed, 6 Mar 2024 09:13:52 +0000 (UTC) Received: from zg8tndyumtaxlji0oc4xnzya.icoremail.net (zg8tndyumtaxlji0oc4xnzya.icoremail.net [46.101.248.176]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D7D0B5EE7B for ; Wed, 6 Mar 2024 09:13:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.101.248.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709716432; cv=none; b=ndRoV8DHMHIKrD6Isl2VWttFKasO82tVCla+VXb2vwS7KA1oo+D5Vur+AXRytwYN/u+miwI+QY0sg4XCgTUkARV2UB+TIDJAnuqgKvfjHs66N99OUPP5MuqGUv3ZS6MOe2nFfPeVr0GlvrzggBkPdyxSjKL78GhPXOVT5UM0sGY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709716432; c=relaxed/simple; bh=vgjcoJJdph/huFuIxzbWX00E1sJslOVBdlRPU0xo/JU=; h=From:To:Cc:Subject:Date:Message-Id; b=bYJqG+EJGFmgg/rfWdaVg0w8pgrlzQKJDWl3t+umV22Qp1HGyCJzL5r1/yu4b1KiSxOEyHR2MRJ6cG52a28UjsL/Ro5AzqG5rHWImXjgHRMtTK9XJt6ehT6vohJToa6LspfSoIhvJnoFvbyQNGL/lyhQGVM3dB/7qiknrf+AfPU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zju.edu.cn; spf=pass smtp.mailfrom=zju.edu.cn; arc=none smtp.client-ip=46.101.248.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zju.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zju.edu.cn Received: from ubuntu.localdomain (unknown [218.12.17.6]) by mail-app3 (Coremail) with SMTP id cC_KCgDXbjqcM+hl8KcCAg--.1124S2; Wed, 06 Mar 2024 17:13:10 +0800 (CST) From: Duoming Zhou To: linux-kernel@vger.kernel.org Cc: linux-um@lists.infradead.org, richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net, axboe@kernel.dk, brauner@kernel.org, hare@suse.de, jinpu.wang@ionos.com, Duoming Zhou Subject: [PATCH] um: Fix return value in ubd_init() Date: Wed, 6 Mar 2024 17:12:59 +0800 Message-Id: <20240306091259.18605-1-duoming@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID:cC_KCgDXbjqcM+hl8KcCAg--.1124S2 X-Coremail-Antispam: 1UD129KBjvdXoW7GF18Gw4rtw4UuFWfZw1kZrb_yoWDCwcEkr ykXr9ruw4DKr47Jry2v343Z3sIya1jkrs3ZayIvry3JFsxCw4avw4fCrn8Aw4UWrsa9FWq yrWIyr93CF47ujkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbTxFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_GcCE 3s1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s 1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0 cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8Jw ACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2Y2ka 0xkIwI1lc7CjxVAaw2AFwI0_Jw0_GFylc2xSY4AK67AK6r4fMxAIw28IcxkI7VAKI48JMx C20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAF wI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20x vE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v2 0xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxV W8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUb0tC7UUUUU== X-CM-SenderInfo: qssqjiasttq6lmxovvfxof0/1tbiAwIMAWXnadMR0wACs0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 --- arch/um/drivers/ubd_kern.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 92ee2697ff3..85e33caf62a 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -1098,7 +1098,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 *), @@ -1109,7 +1109,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); -- 2.17.1