mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
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:
@@ -362,7 +362,7 @@ void setup_ioapic_irq(void)
|
||||
}
|
||||
|
||||
/* pinned irq before use it */
|
||||
if (irq_mark_used(gsi) > NR_MAX_IRQS) {
|
||||
if (irq_mark_used(gsi) >= NR_IRQS) {
|
||||
pr_err("failed to alloc IRQ[%d]", gsi);
|
||||
gsi++;
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user