diff options
author | Brian Behlendorf <[email protected]> | 2022-06-20 21:13:26 +0000 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-07-27 13:38:56 -0700 |
commit | 087f5dedd5f193907d74fd15bf437b21fc0f4f17 (patch) | |
tree | 65560787d7624234894a268f19da445df42c9015 /module | |
parent | c771583f238f74588cfed1c7ecb07cf704905958 (diff) |
Fix -Wattribute-warning in dsl layer
The memcpy(), memmove(), and memset() functions have been annotated
to perform bounds checking when using FORTIFY_SOURCE. A warning is
now generted when writing beyond the end of the specified field.
Alternately, the new struct_group() macro could be used to create
an anonymous union member for use by memcpy(). However, since this
is the only place the macro would be helpful it's preferable to
restructure the code slights to avoid the need for additional
compatibility code when the macro does not exist.
https://lore.kernel.org/lkml/[email protected]/T/
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #13528
Closes #13575
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/dsl_bookmark.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/module/zfs/dsl_bookmark.c b/module/zfs/dsl_bookmark.c index b8e3523ff..861dd9239 100644 --- a/module/zfs/dsl_bookmark.c +++ b/module/zfs/dsl_bookmark.c @@ -347,6 +347,8 @@ dsl_bookmark_set_phys(zfs_bookmark_phys_t *zbm, dsl_dataset_t *snap) spa_t *spa = dsl_dataset_get_spa(snap); objset_t *mos = spa_get_dsl(spa)->dp_meta_objset; dsl_dataset_phys_t *dsp = dsl_dataset_phys(snap); + + memset(zbm, 0, sizeof (zfs_bookmark_phys_t)); zbm->zbm_guid = dsp->ds_guid; zbm->zbm_creation_txg = dsp->ds_creation_txg; zbm->zbm_creation_time = dsp->ds_creation_time; @@ -380,10 +382,6 @@ dsl_bookmark_set_phys(zfs_bookmark_phys_t *zbm, dsl_dataset_t *snap) &zbm->zbm_compressed_freed_before_next_snap, &zbm->zbm_uncompressed_freed_before_next_snap); dsl_dataset_rele(nextds, FTAG); - } else { - bzero(&zbm->zbm_flags, - sizeof (zfs_bookmark_phys_t) - - offsetof(zfs_bookmark_phys_t, zbm_flags)); } } |