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 40ED7C31E4A for ; Thu, 13 Jun 2019 16:19:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1024E20665 for ; Thu, 13 Jun 2019 16:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560442773; bh=r5986k0DGRy7Q+m9nV0Kq6GGrPaodpuicTzsg33PoW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ddzy4on/oeCP6+zzgqdA8BDcKsb/U0Qg9OK1d4Rupoo1FeV5oIM8ZXaTqtO4B7QZq S/QEu7KX7rMd6zVkm27jZwKQLrgmsw1TCw51oVcaCC0NQiCLY6MGtfA9U+Yc+FbdPN LlxPnswZDvIv3f26d0jeooefohXT5Em/jdNkpDfE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733220AbfFMQS7 (ORCPT ); Thu, 13 Jun 2019 12:18:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:57512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731099AbfFMIkE (ORCPT ); Thu, 13 Jun 2019 04:40:04 -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 93237215EA; Thu, 13 Jun 2019 08:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560415204; bh=r5986k0DGRy7Q+m9nV0Kq6GGrPaodpuicTzsg33PoW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2tPPcZFkVToHrgZWIOzShbDagFXzuty/LxNz5fcDUYoF+tQKWigChMX0zdcUEr+VB bZRYkFia6oa6Wpsm3fSUcUSoya4r8T4SzrgB1kjVMOWc0Jvc5UHn0WzvCerRkp2yVq oaUkKbaKHq5rNk3/Th34fu87xpNyGVMg59APDd4k= 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.19 014/118] mm/cma_debug.c: fix the break condition in cma_maxchunk_get() Date: Thu, 13 Jun 2019 10:32:32 +0200 Message-Id: <20190613075644.490063763@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190613075643.642092651@linuxfoundation.org> References: <20190613075643.642092651@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 ad6723e9d110..3e0415076cc9 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