Re: [PATCH v2 2/2] hfsplus: fix uninit-value in hfsplus_delete_cat()

From: ChenXiaoSong
Date: Thu Dec 15 2022 - 20:16:41 EST


在 2022/12/16 3:03, Viacheslav Dubeyko 写道:

Maybe, I am missing something. But where in the second version of the patch
initialization of subfolders?


The first patch of the patchset factor out hfsplus_init_inode() from hfsplus_new_inode():

void hfsplus_init_inode(struct hfsplus_inode_info *hip)
{
INIT_LIST_HEAD(&hip->open_dir_list);
spin_lock_init(&hip->open_dir_lock);
mutex_init(&hip->extents_lock);
atomic_set(&hip->opencnt, 0);
hip->extent_state = 0;
hip->flags = 0;
hip->userflags = 0;
hip->subfolders = 0; /* I am here */
memset(hip->first_extents, 0, sizeof(hfsplus_extent_rec));
memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec));
hip->alloc_blocks = 0;
hip->first_blocks = 0;
hip->cached_start = 0;
hip->cached_blocks = 0;
hip->phys_size = 0;
hip->fs_blocks = 0;
hip->rsrc_inode = NULL;
}