* e820.c : why char* ? (2nd try)
@ 2006-06-29 9:36 PUCCETTI Armand
2006-06-29 10:06 ` Ian Campbell
0 siblings, 1 reply; 2+ messages in thread
From: PUCCETTI Armand @ 2006-06-29 9:36 UTC (permalink / raw)
To: xen-devel
In function
sanitize_e820_map(struct e820entry * biosmap, char * pnr_map)
of file e820.c, the last argument is treated as an integer, but when
compiling with gcc
it belongs to [-128,127].
Inside the body of that function, however, we use that argument as an
int to fill up a table of a different
size, namely:
static struct change_member *change_point [256]
static struct change_member change_point_list [256]
static int __init sanitize_e820_map(struct e820entry * biosmap, char *
pnr_map)
{
...
old_nr = *pnr_map;
...
for (i=0; i < 2*old_nr; i++) {
change_point[i] = &change_point_list[i];
...
}
After the loop, change_point is not completely filled-up, as
change_point [254] and change_point [255]
are never filled nor used.
Is it voluntary that pnr_map gets typed and used like this?
Armand
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: e820.c : why char* ? (2nd try)
2006-06-29 9:36 e820.c : why char* ? (2nd try) PUCCETTI Armand
@ 2006-06-29 10:06 ` Ian Campbell
0 siblings, 0 replies; 2+ messages in thread
From: Ian Campbell @ 2006-06-29 10:06 UTC (permalink / raw)
To: PUCCETTI Armand; +Cc: xen-devel
On Thu, 2006-06-29 at 11:36 +0200, PUCCETTI Armand wrote:
> In function
>
> sanitize_e820_map(struct e820entry * biosmap, char * pnr_map)
>
> of file e820.c, the last argument is treated as an integer, but when
> compiling with gcc it belongs to [-128,127].
This is not a Xen specific issue. On native the value comes from the
BIOS and is a single byte, hence the type. Xen uses the same function.
I don't think it is possible for there to ever be more than 127 entries
in an e820 map so other than potentially wasting a couple of entries in
the tables I don't see a problem.
Ian.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-29 10:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-29 9:36 e820.c : why char* ? (2nd try) PUCCETTI Armand
2006-06-29 10:06 ` Ian Campbell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.