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

[Xen-changelog] [xen-unstable] Loop on actual elfnote array size rather than depending on ELFNOTE_MAX



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1172655899 0
# Node ID 40dc331c44235359f2993c012381afc4cb9d263a
# Parent  9149ef0e61ce24ba3a12c27d0cfd7de6b86aff43
Loop on actual elfnote array size rather than depending on ELFNOTE_MAX
macro.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/python/xen/lowlevel/xc/xc.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff -r 9149ef0e61ce -r 40dc331c4423 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Wed Feb 28 09:41:02 2007 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c Wed Feb 28 09:44:59 2007 +0000
@@ -22,6 +22,8 @@
 #include "xc_dom.h"
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/params.h>
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 /* Needed for Python versions earlier than 2.3. */
 #ifndef PyMODINIT_FUNC
@@ -419,10 +421,13 @@ static PyObject *pyxc_linux_build(XcObje
        goto out;
     }
 
-    if (!(elfnote_dict = PyDict_New()))
+    if ( !(elfnote_dict = PyDict_New()) )
        goto out;
-    for (i = 0; i <= XEN_ELFNOTE_MAX; i++) {
-       switch (dom->parms.elf_notes[i].type) {
+    
+    for ( i = 0; i < ARRAY_SIZE(dom->parms.elf_notes); i++ )
+    {
+       switch ( dom->parms.elf_notes[i].type )
+        {
        case XEN_ENT_NONE:
            continue;
        case XEN_ENT_LONG:

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.