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

Re: [Xen-devel] [PATCH 1 of 4] Fix off-by-one preventing the last elfnote from being read in xc.c



On Wednesday, 28 February 2007 at 09:06, Ian Campbell wrote:
> On Tue, 2007-02-27 at 22:38 -0800, Brendan Cully wrote:
> > # HG changeset patch
> > # User Brendan Cully <brendan@xxxxxxxxx>
> > # Date 1172644688 28800
> > # Node ID a7afd4050ce3201044ac8fec1b4469d758a0fc80
> > # Parent  1c5e6239a8d0381fdbf56d4926f986d7f0ec07c0
> > Fix off-by-one preventing the last elfnote from being read in xc.c.
> > 
> > Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>
> > 
> > diff -r 1c5e6239a8d0 -r a7afd4050ce3 tools/python/xen/lowlevel/xc/xc.c
> > +++ b/tools/python/xen/lowlevel/xc/xc.c     Tue Feb 27 22:38:08 2007 -0800
> > @@ -411,7 +411,7 @@ static PyObject *pyxc_linux_build(XcObje
> >  
> >      if (!(elfnote_dict = PyDict_New()))
> >     goto out;
> > -    for (i = 0; i < XEN_ELFNOTE_MAX; i++) {
> > +    for (i = 0; i <= XEN_ELFNOTE_MAX; i++) {
> >     switch (dom->parms.elf_notes[i].type) {
> >     case XEN_ENT_NONE:
> >         continue;
> 
> I think we should rename XEN_ELFNOTE_MAX to XEN_ELFNOTE_NR (and +1)
> which would be clearer IMHO. The only other place it used is
> "XEN_ELFNOTE_MAX + 1" anyway:
> 
> Change XEN_ELFNOTE_MAX to XEN_ELFNOTE_NR and make it the number of ELF
> notes rather than the index of the last ELF note.

Sounds good to me.

_______________________________________________
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®.