Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp3753961rwi; Wed, 2 Nov 2022 02:43:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LrS1rpmiFnb4KyGBbXgyoHSpv4a0f8oT1iA/U+mdnORPcUTKshwfG9cUBpYpRsw1XhNgf X-Received: by 2002:a63:231a:0:b0:46b:208f:1e57 with SMTP id j26-20020a63231a000000b0046b208f1e57mr21280449pgj.57.1667382187318; Wed, 02 Nov 2022 02:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667382187; cv=none; d=google.com; s=arc-20160816; b=e8S54Nge2ecSrtLSauNlT/P7WV3Ni1gfbqo0MvJT/RreNVHysN1y6E1ssK+fEaOZt7 0WG6h4f52eNJgYvLQhsFMSDySsa5psp4oNo3L0GQ7QXKwgUry5JB0iwM+NDvLU1KAPMj 2spYRjmnq+wLe7x6I/p8MW8aKdnzGzLLHTUapEQlHJ1TfixQFNcsR22mvTlJx/si4XfI jyHAItl+iA40EFRcDARdmrlomfmmORqd4zOt3OHEoXATuXiy4s6Hoi9LIMvR/qj6b8d8 gA9NUqL155N/lbXNX5urBkSC93m4E93RoeyuaSqQG6XuWoH9wb4I9kxjT1FhRFDXuZRv u0CQ== 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:cc:to:from; bh=hcjIgm3pQG4MmqTEF0sjv28xxQrtlIfvGYO8rRyQs0I=; b=ZCPP7wm75xQ01s+moeagU8MQMdBfJlJkTXGXVpLRfGHPHP8iqbqPPRlS3m5q3qkxbL AJxVjIG+4PXy5d1bWDTaQaqXxIkTFeU8LvHbsmksslufHvohgVaZwyzfFccS9b98Sbr2 Ru4nkbbu7zHsq8arrFqd/oUTdRQIwI8+pJvO1bohXdptqTY0Ig3shf5cNwmkGrDaR9sA hjNvZoUjA8pq1XnJ39apz7CiEvIVnv4ZLy24LAcdr67tTGDH3/pTCr4xXKTp+BfsPnqh wvR+4tqi0Nb4Xc+QptDEystitLRQe6ZEudXTT1CkEuWWI1f1uuo0Op6nYbREwVNOrdl6 lpgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a170902ec8c00b0017c2a42fc8csi17651092plg.270.2022.11.02.02.42.54; Wed, 02 Nov 2022 02:43:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230374AbiKBIzq (ORCPT + 97 others); Wed, 2 Nov 2022 04:55:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbiKBIzj (ORCPT ); Wed, 2 Nov 2022 04:55:39 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CBEA27DFC for ; Wed, 2 Nov 2022 01:55:35 -0700 (PDT) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4N2LM64N6fz15MCj; Wed, 2 Nov 2022 16:55:30 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 2 Nov 2022 16:55:33 +0800 Received: from huawei.com (10.175.113.32) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 2 Nov 2022 16:55:33 +0800 From: Liu Shixin To: Dave Kleikamp CC: , , Liu Shixin Subject: [PATCH] fs/jfs: fix assert failed in dbFindBits() Date: Wed, 2 Nov 2022 17:43:48 +0800 Message-ID: <20221102094348.2048443-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org syzkaller reported a bug: BUG at fs/jfs/jfs_dmap.c:2984 assert(bitno < 32) Since we increased bitno before check (mask != 0) in the loop, the value can reach 32. Modify the assert condition to (bitno <= 32) to fix it. Reported-by: syzbot+c6357942fbe0fce51c76@syzkaller.appspotmail.com Signed-off-by: Liu Shixin --- fs/jfs/jfs_dmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index 6b838d3ae7c2..7bd57728edf3 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c @@ -2981,7 +2981,7 @@ static int dbFindBits(u32 word, int l2nb) break; } - ASSERT(bitno < 32); + ASSERT(bitno <= 32); /* return the bit number. */ -- 2.25.1