Messages in this thread | | | Date | Wed, 24 May 2023 12:53:04 +0300 | From | Dan Carpenter <> | Subject | Re: [PATCH v3 6/6] vfio/nvgpu: register device memory for poison handling |
| |
On Wed, Apr 05, 2023 at 11:01:34AM -0700, ankita@nvidia.com 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; > }
| |