HomeFreeBSD

rman: fix overflow in rman_reserve_resource_bound()

Description

rman: fix overflow in rman_reserve_resource_bound()

If the default range of [0, ~0] is given, then (~0 - 0) + 1 == 0. This
in turn will cause any allocation of non-zero size to fail. Zero-sized
allocations are prohibited, so add a KASSERT to this effect.

History indicates it is part of the original rman code. This bug may in
fact be older than some contributors.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30280

(cherry picked from commit bcddaadbef5850ed9f040836d3f25ff57138ae28)

Details

Provenance
ehem_freebsd_m5p.comAuthored on Sep 27 2021, 5:13 PM
mhorneCommitted on Oct 4 2021, 2:15 PM
Reviewer
mhorne
Differential Revision
D30280: kern/rman: fix overflow in rman_reserve_resource_bound()
Parents
rG50c20d90f97f: ntb_hw_intel: fix xeon NTB gen3 bar disable logic
Branches
Unknown
Tags
Unknown