File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -612,7 +612,11 @@ static int vp_vdpa_probe(struct pci_dev *pdev, const struct pci_device_id *id)
612
612
goto mdev_err ;
613
613
}
614
614
615
- mdev_id = kzalloc (sizeof (struct virtio_device_id ), GFP_KERNEL );
615
+ /*
616
+ * id_table should be a null terminated array, so allocate one additional
617
+ * entry here, see vdpa_mgmtdev_get_classes().
618
+ */
619
+ mdev_id = kcalloc (2 , sizeof (struct virtio_device_id ), GFP_KERNEL );
616
620
if (!mdev_id ) {
617
621
err = - ENOMEM ;
618
622
goto mdev_id_err ;
@@ -632,8 +636,8 @@ static int vp_vdpa_probe(struct pci_dev *pdev, const struct pci_device_id *id)
632
636
goto probe_err ;
633
637
}
634
638
635
- mdev_id -> device = mdev -> id .device ;
636
- mdev_id -> vendor = mdev -> id .vendor ;
639
+ mdev_id [ 0 ]. device = mdev -> id .device ;
640
+ mdev_id [ 0 ]. vendor = mdev -> id .vendor ;
637
641
mgtdev -> id_table = mdev_id ;
638
642
mgtdev -> max_supported_vqs = vp_modern_get_num_queues (mdev );
639
643
mgtdev -> supported_features = vp_modern_get_features (mdev );
You can’t perform that action at this time.
0 commit comments