HV: Fixes index out of bounds for addressing irq.

NR_MAX_IRQS is defined as 272 and IRQ_INVALID as 273 which implies
that 272 is a valid irq number. In this case, an illegal access can
occur at run time when irq_desc_array[] or irq_count[] is accessed
with index 272. This fix stops the illegal access by renaming
NR_MAX_IRQS to NR_IRQS and then places proper conditions for range
checks. If the index is >= NR_IRQS, then index is invalid otherwise
its considered valid for accessing irq arrays. IRQ_INVALID definition
is also changed to 0xffffffffU to indicate maximum unsigned value.

Signed-off-by: Madeeha Javed <madeeha_javed@mentor.com>
This commit is contained in:
Madeeha Javed
2018-07-16 14:39:45 +05:00
committed by lijinxia
parent 988a3fe0d6
commit a257f2fadc
5 changed files with 18 additions and 18 deletions

View File

@@ -20,7 +20,7 @@
struct per_cpu_region {
uint64_t *sbuf[ACRN_SBUF_ID_MAX];
uint64_t irq_count[NR_MAX_IRQS];
uint64_t irq_count[NR_IRQS];
uint64_t vmexit_cnt[64];
uint64_t vmexit_time[64];
uint64_t softirq_pending;