lkml.org 
[lkml]   [2023]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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;
> }

\
 
 \ /
  Last update: 2023-05-24 11:53    [W:0.408 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site