diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2019-04-18 21:46:24 +0300 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2019-04-26 17:43:21 +0300 |
commit | 553d66cb1e8667aadb57e3804775c5ce1724a49b (patch) | |
tree | 3dc090290d3953b7d86de91166a4b612025a6129 /drivers/iommu | |
parent | f7b0c4ce8cb3c09cb3cbfc0c663268bf99e5fa9c (diff) | |
download | linux-553d66cb1e8667aadb57e3804775c5ce1724a49b.tar.xz |
iommu/vt-d: Use struct_size() helper
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes, in particular in the
context in which this code is being used.
So, replace code of the following form:
size = sizeof(*info) + level * sizeof(info->path[0]);
with:
size = struct_size(info, path, level);
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/dmar.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index 9c49300e9fb7..6d969a172fbb 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c @@ -145,7 +145,7 @@ dmar_alloc_pci_notify_info(struct pci_dev *dev, unsigned long event) for (tmp = dev; tmp; tmp = tmp->bus->self) level++; - size = sizeof(*info) + level * sizeof(info->path[0]); + size = struct_size(info, path, level); if (size <= sizeof(dmar_pci_notify_info_buf)) { info = (struct dmar_pci_notify_info *)dmar_pci_notify_info_buf; } else { |