mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-20 14:18:53 +07:00
IB/hfi1: Ensure dd->gi_mask can not be overflowed
As the code stands today the array access in remap_intr() is OK. To future proof the code though we should explicitly check to ensure the index value is not outside of the valid range. This is not a straight forward calculation so err on the side of caution. Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
b2f8a04e77
commit
bc54f6714c
@ -12832,7 +12832,12 @@ static void remap_intr(struct hfi1_devdata *dd, int isrc, int msix_intr)
|
||||
/* clear from the handled mask of the general interrupt */
|
||||
m = isrc / 64;
|
||||
n = isrc % 64;
|
||||
dd->gi_mask[m] &= ~((u64)1 << n);
|
||||
if (likely(m < CCE_NUM_INT_CSRS)) {
|
||||
dd->gi_mask[m] &= ~((u64)1 << n);
|
||||
} else {
|
||||
dd_dev_err(dd, "remap interrupt err\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* direct the chip source to the given MSI-X interrupt */
|
||||
m = isrc / 8;
|
||||
|
Loading…
Reference in New Issue
Block a user