]> git.baikalelectronics.ru Git - kernel.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)
commitf9f45709fc52635eda78a8738192f9fb7e1ddcbb
tree58c74f6390637a798e646b74191c7af59ea70878
parent7da1f2558b72353f4a26d78707b272213de86926
iommu/amd: Fix potential @entry null deref

After commit 9f3bfa7f350e ("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: 9f3bfa7f350e ("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