All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] x86/monitor: Fixed CID 1412966: Memory - corruptions (OVERRUN)
@ 2017-06-21 14:56 Razvan Cojocaru
  2017-06-21 15:05 ` Andrew Cooper
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Razvan Cojocaru @ 2017-06-21 14:56 UTC (permalink / raw)
  To: xen-devel; +Cc: andrew.cooper3, tamas, Razvan Cojocaru, jbeulich

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 <rcojocaru@bitdefender.com>

---
Changes since V1:
 - Changed '3' to 'ARRAY_SIZE(...)'.
---
 xen/arch/x86/monitor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c
index bedf13c..af68a79 100644
--- a/xen/arch/x86/monitor.c
+++ b/xen/arch/x86/monitor.c
@@ -133,7 +133,8 @@ int arch_monitor_domctl_event(struct domain *d,
         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) )
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-06-21 16:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21 14:56 [PATCH V2] x86/monitor: Fixed CID 1412966: Memory - corruptions (OVERRUN) Razvan Cojocaru
2017-06-21 15:05 ` Andrew Cooper
2017-06-21 15:10 ` Wei Liu
2017-06-21 15:12   ` Razvan Cojocaru
2017-06-21 15:19     ` Wei Liu
2017-06-21 16:06 ` Jan Beulich
2017-06-21 16:23   ` Razvan Cojocaru
2017-06-21 16:26   ` Razvan Cojocaru

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.