Skip to contentSkip to conversation

hw/ppc/spapr_iommu: Fix the check for invalid upper bits in liobn

PATCH In review Thomas Huth 2 participants 2 messages Apr 21, 2015 – Apr 23, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/ppc/spapr_iommu: Fix the check for invalid upper bits in liobn

The check "liobn & 0xFFFFFFFF00000000ULL" in spapr_tce_find_by_liobn() is completely useless since liobn is only declared as an uint32_t parameter. Fix this by using target_ulong instead (this is what most of the callers of this function are using, too).

---
v2:
- Do not change the hcall_dprintf() into a qemu_log_mask() statement.

---
 hw/ppc/spapr_iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/spapr_iommu.c +2 -2
index f3990fd..995f21b 100644
@@ -41,7 +41,7 @@ enum sPAPRTCEAccess {
 
 static QLIST_HEAD(spapr_tce_tables, sPAPRTCETable) spapr_tce_tables;
 
-static sPAPRTCETable *spapr_tce_find_by_liobn(uint32_t liobn)
+static sPAPRTCETable *spapr_tce_find_by_liobn(target_ulong liobn)
 {
     sPAPRTCETable *tcet;
 
@@ -52,7 +52,7 @@ static sPAPRTCETable *spapr_tce_find_by_liobn(uint32_t liobn)
     }
 
     QLIST_FOREACH(tcet, &spapr_tce_tables, list) {
-        if (tcet->liobn == liobn) {
+        if (tcet->liobn == (uint32_t)liobn) {
             return tcet;
         }
     }
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 6 lines · Thomas Huth

The check "liobn & 0xFFFFFFFF00000000ULL" in spapr_tce_find_by_liobn() is completely useless since liobn is only declared as an uint32_t parameter. Fix this by using target_ulong instead (this is what most of the callers of this function are using, too).

Thanks. Adjusted for a conflict with Alexey's DDW preliminaries and applied to spapr-next.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson