From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94653C31E4A for ; Thu, 13 Jun 2019 16:30:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6267021721 for ; Thu, 13 Jun 2019 16:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560443409; bh=XQuMiD4qxiv2oyyUYHvQPwsnFa+vAr2bhahdxHDAQr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fmCUzCVUoqoBoft09jix0akjhMLNx1mzC89UN9/ZJv22lEN15WyaGUacuS66xLmZl SiqKPNjd9guS6NfAYe4M6MSny2kmpiC3+EGfnjQjCFUGu9rAOx/Tr0Q+nFUlskhgBc FxLLYgM2t5xeJaB7Ob3Q4Rr+2ERXIL85jpUfllJ4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730931AbfFMQ3t (ORCPT ); Thu, 13 Jun 2019 12:29:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:53018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730924AbfFMIfQ (ORCPT ); Thu, 13 Jun 2019 04:35:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C46A920B7C; Thu, 13 Jun 2019 08:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560414916; bh=XQuMiD4qxiv2oyyUYHvQPwsnFa+vAr2bhahdxHDAQr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vT/GPHpIq4bi7M9/g/llhy9SXPv2h0oyxCzFziVF33VBG02AWVmWfDxcIAjt3YzUw TPWkp5rZU189uRwLSuruW/0BD549bse9oFPNzNyO5I2TYUFuxAqCxsA86UXXAo4HRp zc79/t04aRyDhDG1ULA3Xf5N9IXkQC5KZ5df/P4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yue Hu , Andrew Morton , Michal Hocko , Joe Perches , David Rientjes , Dmitry Safonov , Joonsoo Kim , Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 11/81] mm/cma_debug.c: fix the break condition in cma_maxchunk_get() Date: Thu, 13 Jun 2019 10:32:54 +0200 Message-Id: <20190613075649.899197482@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190613075649.074682929@linuxfoundation.org> References: <20190613075649.074682929@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ Upstream commit f0fd50504a54f5548eb666dc16ddf8394e44e4b7 ] If not find zero bit in find_next_zero_bit(), it will return the size parameter passed in, so the start bit should be compared with bitmap_maxno rather than cma->count. Although getting maxchunk is working fine due to zero value of order_per_bit currently, the operation will be stuck if order_per_bit is set as non-zero. Link: http://lkml.kernel.org/r/20190319092734.276-1-zbestahu@gmail.com Signed-off-by: Yue Hu Reviewed-by: Andrew Morton Cc: Michal Hocko Cc: Joe Perches Cc: David Rientjes Cc: Dmitry Safonov Cc: Joonsoo Kim Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/cma_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/cma_debug.c b/mm/cma_debug.c index 275df8b5b22e..c47ea3cfee79 100644 --- a/mm/cma_debug.c +++ b/mm/cma_debug.c @@ -58,7 +58,7 @@ static int cma_maxchunk_get(void *data, u64 *val) mutex_lock(&cma->lock); for (;;) { start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end); - if (start >= cma->count) + if (start >= bitmap_maxno) break; end = find_next_bit(cma->bitmap, bitmap_maxno, start); maxchunk = max(end - start, maxchunk); -- 2.20.1