Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp371697pxb; Thu, 12 Nov 2020 06:06:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwoEiaCerIhRQpl2cc4DajmVkcojsPY3oaZ9To5+6W6NTDSr4QoQbk5rCk/CncqG+iD2Hgm X-Received: by 2002:a17:906:5a97:: with SMTP id l23mr29772021ejq.232.1605189973397; Thu, 12 Nov 2020 06:06:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605189973; cv=none; d=google.com; s=arc-20160816; b=SyRwvKGLhtxWfZB/kXp7BUyZICFhUijyZKn0NE8cZsfaFx6eb8LIzu4ltF4lpGM8NL lVAwfvWMyuNdgWdrF2T2khHLLihYZ8bi7T+KF/AMu9oduviDMNpNAoLaV3T+1m2wPfru SwtiMGZcmqHSVmG5XOksmzaTacGm7dd6JZvU5sZGlc4Wfd5kxY9/cgexKIk3qzGinTst zewYID7pYhV6MrHRRijqRoofLI0Z7lr53E4LvvJvK2UW+y5zYoZgF4wGuJrgkx/+VmLx XAXJj6wQaTeaiSMlccm7fj7nEFsuuk5yqCpOUjxXhTMsqkIpblnCvAFoeMJuXw0WrT3u XCyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=Or1pv69xSuaRST960+B3YPN5smGziVEelFR88tg3Su0=; b=gjUiKfK/gDXzRBRXo4M4QEBWAJ/sxZsuarb+vSCgaI8J9r1Fh0W/gLHr6DhDFsXzsK Qri8RmyRvE3ljhaxK/GhaqJ1hScMO1VavSUYPA76Sv4Ctno7snJGuehb7FXKTXMNE4jP do3lLFth7tASc9WEnGDHqITVlqZoHMId+C8alXyUvQwjUTTwQc0LVCUWrRu7U7hdMgD9 ftWqEVvAHewbd+2XjTx+uL5Mj5CphLpLjsIyh3J1/k8lqrGk2sSp7hZiPyEUwm+mBRwq iMA1EHVzCw03OtgZn2pAuJ0ItPnJVX1Vy/YFiXPcUu1RYtC2IXqmBQ4dt4G8k+MhWECH Me4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr1si3707866ejc.373.2020.11.12.06.05.46; Thu, 12 Nov 2020 06:06:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728274AbgKLOBV (ORCPT + 99 others); Thu, 12 Nov 2020 09:01:21 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:7223 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727819AbgKLOBV (ORCPT ); Thu, 12 Nov 2020 09:01:21 -0500 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CX3Cz2W69zkj7b; Thu, 12 Nov 2020 22:01:03 +0800 (CST) Received: from localhost.localdomain (10.175.101.6) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Thu, 12 Nov 2020 22:01:09 +0800 From: Zhang Xiaoxu To: , , , Subject: [PATCH] watch_queue: Fix wrong return value of watch_queue_set_size() Date: Thu, 12 Nov 2020 09:03:54 -0500 Message-ID: <20201112140354.2260499-1-zhangxiaoxu5@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.101.6] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If memory allocate failed, we should return -ENOMEM rather than 0. Fixes: c73be61cede5 ("pipe: Add general notification queue support") Reported-by: Hulk Robot Signed-off-by: Zhang Xiaoxu --- kernel/watch_queue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c index 0ef8f65bd2d7..3084060a52d2 100644 --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -247,6 +247,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes) if (ret < 0) goto error; + ret = -ENOMEM; pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL); if (!pages) goto error; -- 2.25.4