Skip to content

Commit a5e0ace

Browse files
committed
Merge tag 'erofs-for-5.15-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs
Pull erofs fixes from Gao Xiang: "Two bugfixes to fix the 4KiB blockmap chunk format availability and a dangling pointer usage. There is also a trivial cleanup to clarify compacted_2b if compacted_4b_initial > totalidx. Summary: - fix the dangling pointer use in erofs_lookup tracepoint - fix unsupported chunk format check - zero out compacted_2b if compacted_4b_initial > totalidx" * tag 'erofs-for-5.15-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs: erofs: clear compacted_2b if compacted_4b_initial > totalidx erofs: fix misbehavior of unsupported chunk format check erofs: fix up erofs_lookup tracepoint
2 parents b8f4296 + c40dd3c commit a5e0ace

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

fs/erofs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static struct page *erofs_read_inode(struct inode *inode,
176176
}
177177

178178
if (vi->datalayout == EROFS_INODE_CHUNK_BASED) {
179-
if (!(vi->chunkformat & EROFS_CHUNK_FORMAT_ALL)) {
179+
if (vi->chunkformat & ~EROFS_CHUNK_FORMAT_ALL) {
180180
erofs_err(inode->i_sb,
181181
"unsupported chunk format %x of nid %llu",
182182
vi->chunkformat, vi->nid);

fs/erofs/zmap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,8 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
369369
if (compacted_4b_initial == 32 / 4)
370370
compacted_4b_initial = 0;
371371

372-
if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B)
372+
if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) &&
373+
compacted_4b_initial < totalidx)
373374
compacted_2b = rounddown(totalidx - compacted_4b_initial, 16);
374375
else
375376
compacted_2b = 0;

include/trace/events/erofs.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ TRACE_EVENT(erofs_lookup,
3535
TP_STRUCT__entry(
3636
__field(dev_t, dev )
3737
__field(erofs_nid_t, nid )
38-
__field(const char *, name )
38+
__string(name, dentry->d_name.name )
3939
__field(unsigned int, flags )
4040
),
4141

4242
TP_fast_assign(
4343
__entry->dev = dir->i_sb->s_dev;
4444
__entry->nid = EROFS_I(dir)->nid;
45-
__entry->name = dentry->d_name.name;
45+
__assign_str(name, dentry->d_name.name);
4646
__entry->flags = flags;
4747
),
4848

4949
TP_printk("dev = (%d,%d), pnid = %llu, name:%s, flags:%x",
5050
show_dev_nid(__entry),
51-
__entry->name,
51+
__get_str(name),
5252
__entry->flags)
5353
);
5454

0 commit comments

Comments
 (0)