]> git.baikalelectronics.ru Git - kernel.git/commitdiff
erofs: fix misbehavior of unsupported chunk format check
authorGao Xiang <hsiangkao@linux.alibaba.com>
Wed, 22 Sep 2021 09:51:41 +0000 (17:51 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 23 Sep 2021 15:22:04 +0000 (23:22 +0800)
Unsupported chunk format should be checked with
"if (vi->chunkformat & ~EROFS_CHUNK_FORMAT_ALL)"

Found when checking with 4k-byte blockmap (although currently mkfs
uses inode chunk indexes format by default.)

Link: https://lore.kernel.org/r/20210922095141.233938-1-hsiangkao@linux.alibaba.com
Fixes: 3187d4452d26 ("erofs: support reading chunk-based uncompressed files")
Reviewed-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
fs/erofs/inode.c

index 31ac3a73b390ce9e1072b27a6d1917717a4eec08..a552399e211d833d9fbe3b02098475beb3fbbec3 100644 (file)
@@ -176,7 +176,7 @@ static struct page *erofs_read_inode(struct inode *inode,
        }
 
        if (vi->datalayout == EROFS_INODE_CHUNK_BASED) {
-               if (!(vi->chunkformat & EROFS_CHUNK_FORMAT_ALL)) {
+               if (vi->chunkformat & ~EROFS_CHUNK_FORMAT_ALL) {
                        erofs_err(inode->i_sb,
                                  "unsupported chunk format %x of nid %llu",
                                  vi->chunkformat, vi->nid);