From: Stefano Stabellini Date: Fri, 9 Dec 2016 01:17:04 +0000 (-0800) Subject: fix out of bound access to mode_strings X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~3203 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=28306bccb73ee14b5732f182d3e86c5d0c4d92c5;p=xen.git fix out of bound access to mode_strings mode == ARRAY_SIZE(mode_strings) causes an out of bound access to the mode_strings array. Coverity-ID: 1381859 Signed-off-by: Stefano Stabellini Reviewed-by: Julien Grall --- diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index eb85d92c6d..35d8e8b09a 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -643,7 +643,7 @@ static const char *mode_string(uint32_t cpsr) }; mode = cpsr & PSR_MODE_MASK; - if ( mode > ARRAY_SIZE(mode_strings) ) + if ( mode >= ARRAY_SIZE(mode_strings) ) return "Unknown"; return mode_strings[mode] ? : "Unknown"; }