Skip to content

Commit 1b83ec0

Browse files
Zhihao Chengrichardweinberger
authored andcommitted
ubifs: setflags: Make dirtied_ino_d 8 bytes aligned
Make 'ui->data_len' aligned with 8 bytes before it is assigned to dirtied_ino_d. Since 8871d84("ubifs: convert to fileattr") applied, 'setflags()' only affects regular files and directories, only xattr inode, symlink inode and special inode(pipe/char_dev/block_dev) have none- zero 'ui->data_len' field, so assertion '!(req->dirtied_ino_d & 7)' cannot fail in ubifs_budget_space(). To avoid assertion fails in future evolution(eg. setflags can operate special inodes), it's better to make dirtied_ino_d 8 bytes aligned, after all aligned size is still zero for regular files. Fixes: 1e51764 ("UBIFS: add new flash file system") Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent a6dab66 commit 1b83ec0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ubifs/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static int setflags(struct inode *inode, int flags)
108108
struct ubifs_inode *ui = ubifs_inode(inode);
109109
struct ubifs_info *c = inode->i_sb->s_fs_info;
110110
struct ubifs_budget_req req = { .dirtied_ino = 1,
111-
.dirtied_ino_d = ui->data_len };
111+
.dirtied_ino_d = ALIGN(ui->data_len, 8) };
112112

113113
err = ubifs_budget_space(c, &req);
114114
if (err)

0 commit comments

Comments
 (0)