[bug report] powerpc/mm/iommu, vfio/spapr: Put pages on VFIO container shutdown

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Alexey Kardashevskiy,

The patch 4b6fad7097f8: "powerpc/mm/iommu, vfio/spapr: Put pages on
VFIO container shutdown" from Nov 30, 2016, leads to the following
static checker warning:

	drivers/vfio/vfio_iommu_spapr_tce.c:201 tce_iommu_register_pages()
	error: potential null dereference 'tcemem'.  (kzalloc returns null)

drivers/vfio/vfio_iommu_spapr_tce.c
   176  static long tce_iommu_register_pages(struct tce_container *container,
   177                  __u64 vaddr, __u64 size)
   178  {
   179          long ret = 0;
   180          struct mm_iommu_table_group_mem_t *mem = NULL;
   181          struct tce_iommu_prereg *tcemem;
   182          unsigned long entries = size >> PAGE_SHIFT;
   183  
   184          if ((vaddr & ~PAGE_MASK) || (size & ~PAGE_MASK) ||
   185                          ((vaddr + size) < vaddr))
   186                  return -EINVAL;
   187  
   188          mem = mm_iommu_find(container->mm, vaddr, entries);
   189          if (mem) {
   190                  list_for_each_entry(tcemem, &container->prereg_list, next) {
   191                          if (tcemem->mem == mem)
   192                                  return -EBUSY;
   193                  }
   194          }
   195  
   196          ret = mm_iommu_get(container->mm, vaddr, entries, &mem);
   197          if (ret)
   198                  return ret;
   199  
   200          tcemem = kzalloc(sizeof(*tcemem), GFP_KERNEL);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Not checked.

   201          tcemem->mem = mem;
   202          list_add(&tcemem->next, &container->prereg_list);
   203  
   204          container->enabled = true;
   205  
   206          return 0;
   207  }


regards,
dan carpenter



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux