From nobody Thu Sep 18 23:13:21 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 746CAC43217 for ; Thu, 1 Dec 2022 07:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbiLAHr1 (ORCPT ); Thu, 1 Dec 2022 02:47:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbiLAHrZ (ORCPT ); Thu, 1 Dec 2022 02:47:25 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A82721819 for ; Wed, 30 Nov 2022 23:47:24 -0800 (PST) Received: from canpemm500010.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NN7P975TvzJp3K; Thu, 1 Dec 2022 15:43:57 +0800 (CST) Received: from localhost.localdomain (10.175.112.70) by canpemm500010.china.huawei.com (7.192.105.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 1 Dec 2022 15:47:22 +0800 From: Wang Yufen To: , CC: , Wang Yufen Subject: [PATCH] watch_queue: Fix error return code in watch_queue_set_size() Date: Thu, 1 Dec 2022 16:07:25 +0800 Message-ID: <1669882045-41842-1-git-send-email-wangyufen@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.70] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500010.china.huawei.com (7.192.105.118) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Fix to return a negative error code -ENOMEM instead of 0. Fixes: c73be61cede5 ("pipe: Add general notification queue support") Signed-off-by: Wang Yufen --- kernel/watch_queue.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c index a6f9bdd..fe6e19c 100644 --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -274,19 +274,25 @@ long watch_queue_set_size(struct pipe_inode_info *pip= e, unsigned int nr_notes) goto error; =20 pages =3D kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL); - if (!pages) + if (!pages) { + ret =3D -ENOMEM; goto error; + } =20 for (i =3D 0; i < nr_pages; i++) { pages[i] =3D alloc_page(GFP_KERNEL); - if (!pages[i]) + if (!pages[i]) { + ret =3D -ENOMEM; goto error_p; + } pages[i]->index =3D i * WATCH_QUEUE_NOTES_PER_PAGE; } =20 bitmap =3D bitmap_alloc(nr_notes, GFP_KERNEL); - if (!bitmap) + if (!bitmap) { + ret =3D -ENOMEM; goto error_p; + } =20 bitmap_fill(bitmap, nr_notes); wqueue->notes =3D pages; --=20 1.8.3.1