qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-ppc] [PATCH] hw/ppc/spapr_iommu: Fix the check for invalid upper b


From: Thomas Huth
Subject: [Qemu-ppc] [PATCH] hw/ppc/spapr_iommu: Fix the check for invalid upper bits in liobn
Date: Mon, 20 Apr 2015 17:34:56 +0200

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).
And while we're at it, change the error message printing into a proper
qemu_log_mask(LOG_GUEST_ERROR, ...) call so that it is also possible
to enable this warning without recompiling the binary.

Signed-off-by: Thomas Huth <address@hidden>
---
 hw/ppc/spapr_iommu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index f3990fd..cd26a06 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -41,18 +41,19 @@ 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;
 
     if (liobn & 0xFFFFFFFF00000000ULL) {
-        hcall_dprintf("Request for out-of-bounds LIOBN 0x" TARGET_FMT_lx "\n",
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "Request for out-of-bounds LIOBN 0x" TARGET_FMT_lx "\n",
                       liobn);
         return NULL;
     }
 
     QLIST_FOREACH(tcet, &spapr_tce_tables, list) {
-        if (tcet->liobn == liobn) {
+        if (tcet->liobn == (uint32_t)liobn) {
             return tcet;
         }
     }
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]