Skip to contentSkip to conversation

iommu/amd: Restore IRTE.RemapEn bit after programming IRTE

bug report Dan Carpenter 1 participant 1 message Sep 9, 2020

lore
Share & tools
lore
#0 lore raw

Hello Suravee Suthikulpanit,

This is a semi-automatic email about new static checker warnings.

The patch 26e495f34107: "iommu/amd: Restore IRTE.RemapEn bit after programming IRTE" from Sep 3, 2020, leads to the following Smatch complaint:

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

drivers/iommu/amd/iommu.c
3866 struct irq_cfg *cfg = ir_data->cfg;

  3867		u64 valid = entry->lo.fields_remap.valid;
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The patch adds a new dereference

3868
3869 if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) ||
3870 !entry || !entry->lo.fields_vapic.guest_mode)

                    ^^^^^^

before "entry" has been checked for NULL.

3871 return 0;
3872

regards,
dan carpenter
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu