]> asedeno.scripts.mit.edu Git - linux.git/commit
iommu/vt-d: Use struct_size() helper
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Thu, 18 Apr 2019 18:46:24 +0000 (13:46 -0500)
committerJoerg Roedel <jroedel@suse.de>
Fri, 26 Apr 2019 14:43:21 +0000 (16:43 +0200)
commit553d66cb1e8667aadb57e3804775c5ce1724a49b
tree3dc090290d3953b7d86de91166a4b612025a6129
parentf7b0c4ce8cb3c09cb3cbfc0c663268bf99e5fa9c
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>
drivers/iommu/dmar.c