All of lore.kernel.org
 help / color / mirror / Atom feed
* re: iommu/amd: Implement dm_region call-backs
@ 2015-06-10 15:39 Dan Carpenter
  2015-06-11  7:43 ` Joerg Roedel
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2015-06-10 15:39 UTC (permalink / raw)
  To: jroedel-l3A5Bk7waGM; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Hello Joerg Roedel,

The patch b61238c4a5e1: "iommu/amd: Implement dm_region call-backs"
from May 28, 2015, leads to the following static checker warning:

	drivers/iommu/amd_iommu.c:3153 amd_iommu_get_dm_regions()
	error: potential null dereference 'region'.  (kzalloc returns null)

drivers/iommu/amd_iommu.c
  3138  static void amd_iommu_get_dm_regions(struct device *dev,
  3139                                       struct list_head *head)
  3140  {
  3141          struct unity_map_entry *entry;
  3142          u16 devid;
  3143  
  3144          devid = get_device_id(dev);
  3145  
  3146          list_for_each_entry(entry, &amd_iommu_unity_map, list) {
  3147                  struct iommu_dm_region *region;
  3148  
  3149                  if (devid < entry->devid_start || devid > entry->devid_end)
  3150                          continue;
  3151  
  3152                  region = kzalloc(sizeof(*region), GFP_KERNEL);

No check here.  We may not care and in that case just ignore this
email.  Or add GFP_NOFAIL to silence the warning if you want.

  3153                  region->start = entry->address_start;
  3154                  region->length = entry->address_end - entry->address_start;
  3155                  if (entry->prot & IOMMU_PROT_IR)
  3156                          region->prot |= IOMMU_READ;
  3157                  if (entry->prot & IOMMU_PROT_IW)
  3158                          region->prot |= IOMMU_WRITE;
  3159  
  3160                  list_add_tail(&region->list, head);
  3161          }
  3162  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-11  8:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-10 15:39 iommu/amd: Implement dm_region call-backs Dan Carpenter
2015-06-11  7:43 ` Joerg Roedel
     [not found]   ` <20150611074327.GD16345-l3A5Bk7waGM@public.gmane.org>
2015-06-11  8:02     ` Dan Carpenter
2015-06-11  8:07       ` Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.