Skip to content

Commit 53e4efa

Browse files
committed
orangefs: fix out-of-bounds fsid access
Arnd Bergmann sent a patch to fsdevel, he says: "orangefs_statfs() copies two consecutive fields of the superblock into the statfs structure, which triggers a warning from the string fortification helpers" Jan Kara suggested an alternate way to do the patch to make it more readable. I ran both ideas through xfstests and both seem fine. This patch is based on Jan Kara's suggestion. Signed-off-by: Mike Marshall <[email protected]>
1 parent dd5a440 commit 53e4efa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/orangefs/super.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ static int orangefs_statfs(struct dentry *dentry, struct kstatfs *buf)
201201
(long)new_op->downcall.resp.statfs.files_avail);
202202

203203
buf->f_type = sb->s_magic;
204-
memcpy(&buf->f_fsid, &ORANGEFS_SB(sb)->fs_id, sizeof(buf->f_fsid));
204+
buf->f_fsid.val[0] = ORANGEFS_SB(sb)->fs_id;
205+
buf->f_fsid.val[1] = ORANGEFS_SB(sb)->id;
205206
buf->f_bsize = new_op->downcall.resp.statfs.block_size;
206207
buf->f_namelen = ORANGEFS_NAME_MAX;
207208

0 commit comments

Comments
 (0)