diff options
author | chenqiuhao1997 <[email protected]> | 2024-05-10 23:47:21 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-10 08:47:21 -0700 |
commit | 41ae864b69991f7e13d5171f54a42c721b297233 (patch) | |
tree | 7a32e47472b3047f5ca8b28d3924bb75498c1fcf /module/os/freebsd | |
parent | 1ede0c716beeee4a720ff5c361121021555d7e3c (diff) |
Replace P2ALIGN with P2ALIGN_TYPED and delete P2ALIGN.
In P2ALIGN, the result would be incorrect when align is unsigned
integer and x is larger than max value of the type of align.
In that case, -(align) would be a positive integer, which means
high bits would be zero and finally stay zero after '&' when
align is converted to a larger integer type.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Youzhong Yang <[email protected]>
Signed-off-by: Qiuhao Chen <[email protected]>
Closes #15940
Diffstat (limited to 'module/os/freebsd')
-rw-r--r-- | module/os/freebsd/zfs/vdev_geom.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/module/os/freebsd/zfs/vdev_geom.c b/module/os/freebsd/zfs/vdev_geom.c index 9d8897191..38c1d8e9e 100644 --- a/module/os/freebsd/zfs/vdev_geom.c +++ b/module/os/freebsd/zfs/vdev_geom.c @@ -457,7 +457,7 @@ vdev_geom_read_config(struct g_consumer *cp, nvlist_t **configp) ZFS_LOG(1, "Reading config from %s...", pp->name); psize = pp->mediasize; - psize = P2ALIGN(psize, (uint64_t)sizeof (vdev_label_t)); + psize = P2ALIGN_TYPED(psize, sizeof (vdev_label_t), uint64_t); size = sizeof (*vdev_lists[0]) + pp->sectorsize - ((sizeof (*vdev_lists[0]) - 1) % pp->sectorsize) - 1; |