Skip to content

Commit

Permalink
hv: fix potential NULL pointer dereferrence in ivshmem.c
Browse files Browse the repository at this point in the history
secure coding fix.

Tracked-On: projectacrn#8566
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
  • Loading branch information
yonghuah committed Apr 10, 2024
1 parent 9325664 commit 9a5ae20
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hypervisor/dm/vpci/ivshmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,10 @@ static void init_ivshmem_vdev(struct pci_vdev *vdev)
PCIM_HDRTYPE_NORMAL | ((vdev->bdf.bits.f == 0U) ? PCIM_MFDEV : 0U));

pci_vdev_write_vcfg(vdev, PCIV_SUB_VENDOR_ID, 2U, IVSHMEM_INTEL_SUBVENDOR_ID);
pci_vdev_write_vcfg(vdev, PCIV_SUB_SYSTEM_ID, 2U, region->region_id);
if (region != NULL) {
pci_vdev_write_vcfg(vdev, PCIV_SUB_SYSTEM_ID, 2U, region->region_id);
}

add_vmsix_capability(vdev, MAX_IVSHMEM_MSIX_TBL_ENTRY_NUM, IVSHMEM_MSIX_BAR);

/* initialize ivshmem bars */
Expand Down

0 comments on commit 9a5ae20

Please sign in to comment.