From patchwork Wed Nov 2 09:43:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 14099 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3495947wru; Wed, 2 Nov 2022 01:57:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4psdk+Is0185qhhXvExDc+LJ7a+vUbFL2Rt2/NtzeV66FlLB35gVoNaBuyDJa8AA1ZV4Zf X-Received: by 2002:a17:907:2d1e:b0:7a9:c2f9:2c2c with SMTP id gs30-20020a1709072d1e00b007a9c2f92c2cmr22418219ejc.405.1667379470963; Wed, 02 Nov 2022 01:57:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667379470; cv=none; d=google.com; s=arc-20160816; b=I03iwqbv8Q9EW94XqXp/8VxypIaNmfBlhHm8PusYge3peR4Eop/JHDY2biCsvYguqW r4yrIf4IpJAKk5Ye6FJPcKuwEymJjbZw4+5Fa4Q/mUqmnFh9EuQCcRwf6yniJ9MmKB4p 2OgljsoemIm37HkLx/B2qFUQ7uDVMIXEECUbdf1WVgDeiOWFO3zySyQ7FuCS1jX8et2/ /WKFkNOvenUS5bHK6diCdMJe4tHsfmwg1l+f+Owl96df3k3G7RcM48ITf4NRrKnSO65v fVaF6427l3xjG2FeLvo2Ng4my3yGlZOl9RNeeaLhZzUsnjGHgD1LhOXlrcZwfIEVVQ+N Xc5A== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds7-20020a170907724700b0078d459a1ce9si15216618ejc.693.2022.11.02.01.57.27; Wed, 02 Nov 2022 01:57:50 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748374096515936189?= X-GMAIL-MSGID: =?utf-8?q?1748374096515936189?= 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. */