diff options
author | Mike Marshall <hubcap@omnibond.com> | 2024-05-01 22:20:36 +0200 |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2024-05-06 16:10:36 +0200 |
commit | 53e4efa470d5fc6a96662d2d3322cfc925818517 (patch) | |
tree | 4b191bdccc3c3f9c429cb67e822a7506d19a1915 | |
parent | Linux 6.9-rc7 (diff) | |
download | linux-53e4efa470d5fc6a96662d2d3322cfc925818517.tar.xz linux-53e4efa470d5fc6a96662d2d3322cfc925818517.zip |
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 <hubcap@omnibond.com>
-rw-r--r-- | fs/orangefs/super.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index 34849b4a3243..907765673765 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c @@ -201,7 +201,8 @@ static int orangefs_statfs(struct dentry *dentry, struct kstatfs *buf) (long)new_op->downcall.resp.statfs.files_avail); buf->f_type = sb->s_magic; - memcpy(&buf->f_fsid, &ORANGEFS_SB(sb)->fs_id, sizeof(buf->f_fsid)); + buf->f_fsid.val[0] = ORANGEFS_SB(sb)->fs_id; + buf->f_fsid.val[1] = ORANGEFS_SB(sb)->id; buf->f_bsize = new_op->downcall.resp.statfs.block_size; buf->f_namelen = ORANGEFS_NAME_MAX; |