hv:fix possible buffer overflow in 'ptirq_get_intr_data()'

- 'buffer'with size of 'buffer_cnt',  will overflow in
    next loop if 'index == buffer_cnt - 1'.

Tracked-On: #1252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yonghua Huang 2018-12-18 21:27:36 +08:00 committed by wenlingz
parent 6aa4227277
commit b8ffac8bac
1 changed files with 1 additions and 1 deletions

View File

@ -229,7 +229,7 @@ uint32_t ptirq_get_intr_data(const struct acrn_vm *target_vm, uint64_t *buffer,
buffer[index + 1U] = entry->intr_count;
index += 2U;
if (index >= buffer_cnt) {
if (index > (buffer_cnt - 2U)) {
break;
}
}