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.8 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 2BA0AC43613 for ; Thu, 20 Jun 2019 18:31:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F36BE20665 for ; Thu, 20 Jun 2019 18:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561055498; bh=htf8TTPlPe02GHqHbnqYzQej1yuFd/WJaoxRv4FZjBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=S1Q5qRXM3zimr9YSlTa+Bz071YqL31prirjT+J9SR3KTwEBTSh2EayDzACD0fNkvt gFjuzZUc8lclBBj4z2nX5/qpd/iH/LyibhDeqm5JxbiWxsSDnib51U+nYluhm0GKd2 9+RNwnHIn0GniAkNpb4B4dj9XzbDzBMxLDkIz4HQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726614AbfFTR7b (ORCPT ); Thu, 20 Jun 2019 13:59:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:47084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726591AbfFTR73 (ORCPT ); Thu, 20 Jun 2019 13:59:29 -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 69E5020B1F; Thu, 20 Jun 2019 17:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561053568; bh=htf8TTPlPe02GHqHbnqYzQej1yuFd/WJaoxRv4FZjBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=egohCAQi1e670872QHRYmLBWeiJZ4i5tXSTqnlwFzh8eVQvqou7yrSKDXGBTCYk7k 0eTeetCwh7JPXbN2YegswnzZX0rnSIJHw+EmCTsSgZoPb8/pavpdRiM6iMijOdgB0x SbrWX8A7Pj2epN22dhloOR6xIbEltTEarnp7eewI= 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.4 06/84] mm/cma_debug.c: fix the break condition in cma_maxchunk_get() Date: Thu, 20 Jun 2019 19:56:03 +0200 Message-Id: <20190620174338.649164636@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174337.538228162@linuxfoundation.org> References: <20190620174337.538228162@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 f8e4b60db167..da50dab56b70 100644 --- a/mm/cma_debug.c +++ b/mm/cma_debug.c @@ -57,7 +57,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