x86/monitor: Fixed CID 1412966: Memory - corruptions (OVERRUN)
PATCH v3 1/1 x86/monitor: Fixed CID 1412966: Memory - corruptions (OVERRUN)
Fixed an issue where the maximum index allowed (31) goes beyond the actual number of array elements (4) of ad->monitor.write_ctrlreg_mask.
Coverity-ID: 1412966
Signed-off-by Razvan Cojocaru <[email protected]>
Reviewed-by Andrew Cooper <[email protected]>
---
Changes since V2:
- Removed stale comment.
- Indentation.
- Added Reviewed-by.
--- xen/arch/x86/monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/monitor.c +2 -2
@@ -132,8 +132,8 @@ int arch_monitor_domctl_event(struct domain *d,unsigned int ctrlreg_bitmask;bool_t old_status; -/* sanity check: avoid left-shift undefined behavior */ -if (unlikely (mop->u.mov_to_cr.index >31 ) ) +if (unlikely (mop->u.mov_to_cr.index >= +ARRAY_SIZE (ad->monitor.write_ctrlreg_mask)) )return -EINVAL ;if (unlikely (mop->u.mov_to_cr.pad1 || mop->u.mov_to_cr.pad2) )
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel