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

[Xen-devel] possible bug on libxc ? on amd64


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Enrico Maniciati" <enrico.maniciati@xxxxxxxxxxx>
  • Date: Sat, 1 Dec 2007 16:25:13 +0100
  • Delivery-date: Sat, 01 Dec 2007 07:26:03 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: Acg0Ll4dJI08UQfZTXaSWK06d7OwKA==

 

In function  :

 

Elf64_Shdr*

xc_core_shdr_get(struct xc_core_section_headers *sheaders) {

    Elf64_Shdr *shdr;

 

    if ( sheaders->num == sheaders->num_max )

    {

        Elf64_Shdr *shdrs;

        if ( sheaders->num_max + SHDR_INC < sheaders->num_max )  <--- in this point

 

 

// I think at this point ,sheaders->num_max + SHDR_INC always is major or equal than sheaders->num_max 

 

// I think : x + y > x     

 

My consideration was only for resolving error compiling because I not have time to learn what libxc are and what I can use function

 

J

 

 

 

       {

            errno = E2BIG;

            return NULL;

        }

 

        sheaders->num_max += SHDR_INC;

        shdrs = realloc(sheaders->shdrs,

                        sizeof(sheaders->shdrs[0]) * sheaders->num_max);

 

 

        if ( shdrs == NULL ) <<-- word wrap ??

            return NULL;

        sheaders->shdrs = shdrs;

 

 

i think this are correct:

 

       if ( shdrs == NULL ) return NULL;

 

        sheaders->shdrs = shdrs;

 

 

or:

 

 

if ( shdrs == NULL ) {return NULL};

        sheaders->shdrs = shdrs;

 

    }

 

    shdr = &sheaders->shdrs[sheaders->num];

    sheaders->num++;

    memset(shdr, 0, sizeof(*shdr));

    return shdr;

}

 

 

Always happy c++

 

Ps.

C++ are always better than other J 

 

----------------------------------------------------------------------------------------------------------------

 

Maniciati Enrico

Consulenza,progettazione,

realizzazione e assistenza

reti e sistemi informatici

 

email: enrico.maniciati@xxxxxxxxxxx

Skype: erikm.project

Msn: enrico.maniciati@xxxxxxxxxx

----------------------------------------------------------------------------------------------------------------


Il presente messaggio di posta elettronica e l’eventuale allegato contengono informazioni di carattere confidenziale rivolte esclusivamente al destinatario sopra indicato. E’ vietato l’uso, la diffusione, distribuzione o riproduzione da parte di ogni altro soggetto. Nel caso aveste ricevuto questo messaggio per errore, siete pregati di segnalarlo immediatamente al mittente e distruggere quanto ricevuto senza farne copia. I dati personali sono trattati da Maniciati Enrico via L.Ariosto,13 30039 Strà (VE) in conformità al DL.vo 196/2003

----------------------------------------------------------------------------------------------------------------

 

 

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

 


Rackspace

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