WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-4.0-testing] Xen: fix various checks of unsigned in

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] Xen: fix various checks of unsigned integers < 0
From: "Xen patchbot-4.0-testing" <patchbot-4.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 30 Oct 2010 15:35:10 -0700
Delivery-date: Sat, 30 Oct 2010 15:35:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1288374294 -3600
# Node ID 43b3f8ceb991c8410541fa763d2265dc3a539baa
# Parent  179150c0b36614a6a596ca5e872fea80d852a819
Xen: fix various checks of unsigned integers < 0

Some of these could be benignly discarded by the compiler but some are
actual bugs.

Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
xen-unstable changeset:   22336:49803ac994f4
xen-unstable date:        Fri Oct 29 18:05:50 2010 +0100
---
 xen/arch/x86/mm.c                      |    4 ++--
 xen/arch/x86/physdev.c                 |    2 +-
 xen/arch/x86/platform_hypercall.c      |    1 -
 xen/arch/x86/x86_emulate/x86_emulate.c |    2 +-
 xen/drivers/cpufreq/cpufreq.c          |    3 +--
 5 files changed, 5 insertions(+), 7 deletions(-)

diff -r 179150c0b366 -r 43b3f8ceb991 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Fri Oct 29 10:44:23 2010 +0100
+++ b/xen/arch/x86/mm.c Fri Oct 29 18:44:54 2010 +0100
@@ -4223,7 +4223,7 @@ static int handle_iomem_range(unsigned l
         ent.size = (uint64_t)(s - ctxt->s) << PAGE_SHIFT;
         ent.type = E820_RESERVED;
         buffer = guest_handle_cast(ctxt->map.buffer, e820entry_t);
-        if ( __copy_to_guest_offset(buffer, ctxt->n, &ent, 1) < 0 )
+        if ( __copy_to_guest_offset(buffer, ctxt->n, &ent, 1) )
             return -EFAULT;
         ctxt->n++;
     }
@@ -4439,7 +4439,7 @@ long arch_memory_op(int op, XEN_GUEST_HA
             }
             if ( ctxt.map.nr_entries <= ctxt.n + (e820.nr_map - i) )
                 return -EINVAL;
-            if ( __copy_to_guest_offset(buffer, ctxt.n, e820.map + i, 1) < 0 )
+            if ( __copy_to_guest_offset(buffer, ctxt.n, e820.map + i, 1) )
                 return -EFAULT;
             ctxt.s = PFN_UP(e820.map[i].addr + e820.map[i].size);
         }
diff -r 179150c0b366 -r 43b3f8ceb991 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c    Fri Oct 29 10:44:23 2010 +0100
+++ b/xen/arch/x86/physdev.c    Fri Oct 29 18:44:54 2010 +0100
@@ -202,7 +202,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
         if ( copy_from_guest(&eoi, arg, 1) != 0 )
             break;
         ret = -EINVAL;
-        if ( eoi.irq < 0 || eoi.irq >= v->domain->nr_pirqs )
+        if ( eoi.irq >= v->domain->nr_pirqs )
             break;
         if ( v->domain->arch.pirq_eoi_map )
             evtchn_unmask(v->domain->pirq_to_evtchn[eoi.irq]);
diff -r 179150c0b366 -r 43b3f8ceb991 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Fri Oct 29 10:44:23 2010 +0100
+++ b/xen/arch/x86/platform_hypercall.c Fri Oct 29 18:44:54 2010 +0100
@@ -413,7 +413,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
         }
 
         if ( (g_info->xen_cpuid >= NR_CPUS) ||
-             (g_info->xen_cpuid < 0) ||
              !cpu_present(g_info->xen_cpuid) )
         {
             g_info->flags |= XEN_PCPU_FLAGS_INVALID;
diff -r 179150c0b366 -r 43b3f8ceb991 xen/arch/x86/x86_emulate/x86_emulate.c
--- a/xen/arch/x86/x86_emulate/x86_emulate.c    Fri Oct 29 10:44:23 2010 +0100
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c    Fri Oct 29 18:44:54 2010 +0100
@@ -2102,7 +2102,7 @@ x86_emulate(
             _regs.edx = (uint32_t)(((int32_t)_regs.eax < 0) ? -1 : 0);
             break;
         case 8:
-            _regs.edx = (_regs.eax < 0) ? -1 : 0;
+            _regs.edx = ((int64_t)_regs.eax < 0) ? -1 : 0;
             break;
         }
         break;
diff -r 179150c0b366 -r 43b3f8ceb991 xen/drivers/cpufreq/cpufreq.c
--- a/xen/drivers/cpufreq/cpufreq.c     Fri Oct 29 10:44:23 2010 +0100
+++ b/xen/drivers/cpufreq/cpufreq.c     Fri Oct 29 18:44:54 2010 +0100
@@ -115,8 +115,7 @@ int cpufreq_limit_change(unsigned int cp
     if (!cpu_online(cpu) || !data || !processor_pminfo[cpu])
         return -ENODEV;
 
-    if ((perf->platform_limit < 0) || 
-        (perf->platform_limit >= perf->state_count))
+    if (perf->platform_limit >= perf->state_count)
         return -EINVAL;
 
     memcpy(&policy, data, sizeof(struct cpufreq_policy)); 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.0-testing] Xen: fix various checks of unsigned integers < 0, Xen patchbot-4.0-testing <=