]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
uma: New check_align_mask(): Validate alignments (INVARIANTS)
authorOlivier Certner <olce.freebsd@certner.fr>
Fri, 13 Oct 2023 14:09:51 +0000 (16:09 +0200)
committerMark Johnston <markj@FreeBSD.org>
Thu, 2 Nov 2023 13:30:03 +0000 (09:30 -0400)
commit87090f5e5a7b927a2ab30878435f6dcba0705a1d
tree986686b34bef27a323d0d873059dc023b49c0483
parent3d8f548b9e5772ff6890bdc01f7ba7b76203857d
uma: New check_align_mask(): Validate alignments (INVARIANTS)

New function check_align_mask() asserts (under INVARIANTS) that the mask
fits in a (signed) integer (see the comment) and that the corresponding
alignment is a power of two.

Use check_align_mask() in uma_set_align_mask() and also in uma_zcreate()
to replace the KASSERT() there (that was checking only for a power of
2).

Reviewed by:            kib, markj
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42263
sys/vm/uma_core.c