ia64/xen-unstable

changeset 14173:40dc331c4423

Loop on actual elfnote array size rather than depending on ELFNOTE_MAX
macro.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Feb 28 09:44:59 2007 +0000 (2007-02-28)
parents 9149ef0e61ce
children 9edd8d7c9355
files tools/python/xen/lowlevel/xc/xc.c
line diff
     1.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Wed Feb 28 09:41:02 2007 +0000
     1.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Wed Feb 28 09:44:59 2007 +0000
     1.3 @@ -23,6 +23,8 @@
     1.4  #include <xen/hvm/hvm_info_table.h>
     1.5  #include <xen/hvm/params.h>
     1.6  
     1.7 +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
     1.8 +
     1.9  /* Needed for Python versions earlier than 2.3. */
    1.10  #ifndef PyMODINIT_FUNC
    1.11  #define PyMODINIT_FUNC DL_EXPORT(void)
    1.12 @@ -419,10 +421,13 @@ static PyObject *pyxc_linux_build(XcObje
    1.13  	goto out;
    1.14      }
    1.15  
    1.16 -    if (!(elfnote_dict = PyDict_New()))
    1.17 +    if ( !(elfnote_dict = PyDict_New()) )
    1.18  	goto out;
    1.19 -    for (i = 0; i <= XEN_ELFNOTE_MAX; i++) {
    1.20 -	switch (dom->parms.elf_notes[i].type) {
    1.21 +    
    1.22 +    for ( i = 0; i < ARRAY_SIZE(dom->parms.elf_notes); i++ )
    1.23 +    {
    1.24 +	switch ( dom->parms.elf_notes[i].type )
    1.25 +        {
    1.26  	case XEN_ENT_NONE:
    1.27  	    continue;
    1.28  	case XEN_ENT_LONG: