mirror of
https://github.com/opnsense/src.git
synced 2026-04-20 21:59:20 -04:00
mpr, mps: Fix an off-by-one bug in the BTDH_MAPPING ioctl
The device mapping table contains sc->max_devices entries, so only indices in [0, sc->max_devices) are valid. MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27964
This commit is contained in:
parent
de828a91db
commit
adc0dcc352
2 changed files with 2 additions and 2 deletions
|
|
@ -2226,7 +2226,7 @@ mpr_user_btdh(struct mpr_softc *sc, mpr_btdh_mapping_t *data)
|
|||
if (bus != 0)
|
||||
return (EINVAL);
|
||||
|
||||
if (target > sc->max_devices) {
|
||||
if (target >= sc->max_devices) {
|
||||
mpr_dprint(sc, MPR_XINFO, "Target ID is out of range "
|
||||
"for Bus/Target to DevHandle mapping.");
|
||||
return (EINVAL);
|
||||
|
|
|
|||
|
|
@ -2128,7 +2128,7 @@ mps_user_btdh(struct mps_softc *sc, mps_btdh_mapping_t *data)
|
|||
if (bus != 0)
|
||||
return (EINVAL);
|
||||
|
||||
if (target > sc->max_devices) {
|
||||
if (target >= sc->max_devices) {
|
||||
mps_dprint(sc, MPS_FAULT, "Target ID is out of range "
|
||||
"for Bus/Target to DevHandle mapping.");
|
||||
return (EINVAL);
|
||||
|
|
|
|||
Loading…
Reference in a new issue