On Wed, Apr 05, 2023 at 11:01:34AM -0700, ankita@xxxxxxxxxx wrote: > @@ -188,7 +277,20 @@ nvgpu_vfio_pci_fetch_memory_property(struct pci_dev *pdev, > > ret = device_property_read_u64(&(pdev->dev), "nvidia,gpu-mem-size", > &(nvdev->mem_prop.mem_length)); > - return ret; > + if (ret) > + return ret; > + > + /* > + * A bitmap is maintained to teack the pages that are poisoned. Each > + * page is represented by a bit. Allocation size in bytes is > + * determined by shifting the device memory size by PAGE_SHIFT to > + * determine the number of pages; and further shifted by 3 as each > + * byte could track 8 pages. > + */ > + nvdev->mem_prop.pfn_bitmap > + = vzalloc(nvdev->mem_prop.mem_length >> (PAGE_SHIFT + 3)); This allocation needs a NULL check. regards, dan carpenter > + > + return 0; > }