x86/monitor: Fixed CID 1412966: Memory - corruptions (OVERRUN)
PATCH 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
--- xen/arch/x86/monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/monitor.c +1 -1
@@ -133,7 +133,7 @@ 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 >3 ) )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
Quoted 14 lines · Razvan Cojocaru
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: 1412966Signed-off-by Razvan Cojocaru <[email protected]>--- xen/arch/x86/monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/x86/monitor.c +0
-0
xen/arch/x86/monitor.c int arch_monitor_domctl_event(struct domain *d, · line 138
Quoted 7 lines
xen/arch/x86/monitor.c +1
-1@@ -133,7 +133,7 @@ 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 >3 ) ) = ARRAY_SIZE(ad->monitor.write_ctrlreg_mask)
?
~Andrew
Quoted 3 lines
xen/arch/x86/monitor.c +0
-0return -EINVAL ;if ( unlikely(mop->u.mov_to_cr.pad1 || mop->u.mov_to_cr.pad2) )
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 17 lines · Andrew Cooper
Quoted 16 lines · Razvan Cojocaru
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: 1412966Signed-off-by Razvan Cojocaru <[email protected]>--- xen/arch/x86/monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/x86/monitor.c +0
-0@@ -133,7 +133,7 @@ int arch_monitor_domctl_event(struct domain *d,bool_t old_status;
Quoted 5 lines
xen/arch/x86/monitor.c int arch_monitor_domctl_event(struct domain *d,
Quoted 4 lines
xen/arch/x86/monitor.c +1
-1/* sanity check: avoid left-shift undefined behavior */ -if (unlikely (mop->u.mov_to_cr.index >31 ) ) +if (unlikely (mop->u.mov_to_cr.index >3 ) ) = ARRAY_SIZE(ad->monitor.write_ctrlreg_mask)?
Sorry - that should be ">= ARRAY" when it doesn't get interpreted as an email quotation.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 17 lines · Andrew Cooper
Quoted 16 lines · Razvan Cojocaru
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: 1412966Signed-off-by Razvan Cojocaru <[email protected]>--- xen/arch/x86/monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/x86/monitor.c +0
-0@@ -133,7 +133,7 @@ int arch_monitor_domctl_event(struct domain *d,bool_t old_status;
Quoted 6 lines
Quoted 6 lines
xen/arch/x86/monitor.c +1
-1/* sanity check: avoid left-shift undefined behavior */ -if (unlikely (mop->u.mov_to_cr.index >31 ) ) +if (unlikely (mop->u.mov_to_cr.index >3 ) ) = ARRAY_SIZE(ad->monitor.write_ctrlreg_mask)?
Yes, that'd be the right way to do it. :)
V2 coming up in a second.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel