]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
iommu/amd: Fix potential @entry null deref
authorJoao Martins <joao.m.martins@oracle.com>
Thu, 10 Sep 2020 17:16:21 +0000 (18:16 +0100)
committerJoerg Roedel <jroedel@suse.de>
Fri, 18 Sep 2020 08:35:11 +0000 (10:35 +0200)
commit14c4acc5ed22c21f9821103be7c48efdf9763584
tree58c74f6390637a798e646b74191c7af59ea70878
parent856deb866d16e29bd65952e0289066f6078af773
iommu/amd: Fix potential @entry null deref

After commit 26e495f34107 ("iommu/amd: Restore IRTE.RemapEn bit after
programming IRTE"), smatch warns:

drivers/iommu/amd/iommu.c:3870 amd_iommu_deactivate_guest_mode()
        warn: variable dereferenced before check 'entry' (see line 3867)

Fix this by moving the @valid assignment to after @entry has been checked
for NULL.

Fixes: 26e495f34107 ("iommu/amd: Restore IRTE.RemapEn bit after programming IRTE")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Link: https://lore.kernel.org/r/20200910171621.12879-1-joao.m.martins@oracle.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/iommu.c