[PATCH v3 6/6] vfio/nvgpu: register device memory for poison handling
Dan Carpenter
dan.carpenter at linaro.org
Wed May 24 02:53:04 PDT 2023
On Wed, Apr 05, 2023 at 11:01:34AM -0700, ankita at 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;
> }
More information about the linux-arm-kernel
mailing list