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

Details

Provenance
ehem_freebsd_m5p.comAuthored on Sep 27 2021, 5:13 PM
mhorneCommitted on Sep 27 2021, 5:38 PM
Reviewer
mhorne
Differential Revision
D31312: kern/rman: warn/KASSERT() on garbled reservations
Parents
rG0eb901f76007: pci_host_generic: implement bus_translate_resource (for LinuxKPI)
Branches
Unknown
Tags
Unknown