mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
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 <behlendorf1@llnl.gov> Reviewed-by: Youzhong Yang <yyang@mathworks.com> Signed-off-by: Qiuhao Chen <chenqiuhao1997@gmail.com> Closes #15940
This commit is contained in:
committed by
Brian Behlendorf
parent
2566592045
commit
9edf6af4ae
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user