Skip to contentSkip to conversation

libxc/load_aou9.c signness fix gcc4

DISCUSSION Jerone Young 3 participants 3 messages Jun 24, 2005

lore
Share & tools
lore
#0 lore raw

another gcc sign fix.

--- tools/libxc/xc_load_aout9.c.old 2005-06-24 14:50:16.000000000
-0500
+++ tools/libxc/xc_load_aout9.c 2005-06-24 15:02:08.000000000 -0500 @@ -19,7 +19,7 @@
static int parseaout9image(char *, unsigned long, struct
domain_setup_info *);
static int loadaout9image(char *, unsigned long, int, u32, unsigned
long *, struct domain_setup_info *);
static void copyout(int, u32, unsigned long *, unsigned long, void *,
int);
-struct Exec *get_header(unsigned char *, unsigned long, struct Exec *); +struct Exec *get_header(char *, unsigned long, struct Exec *);

int
@@ -139,7 +139,7 @@ copyout(
*/
struct Exec *
get_header(
- unsigned char *image,
+ char *image,
unsigned long image_size,
struct Exec *ehdr)
{

Signature · 4 lines
Jerone Young
IBM Linux Technology Center
[email protected]
512-838-1157 (T/L: 678-1157)
#1 lore raw
Quoted 1 line

another gcc sign fix.

This fix is bad. The proper fix is to add a cast. An unsigned buffer will result in incorrect extraction of big-endian values.

Quoted 10 lines
(quoted diff) +1 -1
-struct Exec *get_header(unsigned char *, unsigned long, struct Exec *);
+struct Exec *get_header(char *, unsigned long, struct Exec *);

struct Exec *
get_header(

(quoted diff) +1 -1
-    unsigned char *image,
+    char *image,
    unsigned long image_size,
    struct Exec *ehdr)
Quoted 2 lines

Jerone Young
[email protected]

Tim Newsham
http://www.lava.net/~newsham/

#2 lore raw
In reply to Jerone Young

There are bit shifting operations inside of
get_header() that, imho, will break if you
turn image signed.

Quoted 39 lines · Jerone Young

another gcc sign fix.

--- tools/libxc/xc_load_aout9.c.old 2005-06-24 14:50:16.000000000
-0500
+++ tools/libxc/xc_load_aout9.c 2005-06-24 15:02:08.000000000 -0500

(quoted diff) +1 -1
@@ -19,7 +19,7 @@
 static int parseaout9image(char *, unsigned long, struct
 domain_setup_info *);
 static int loadaout9image(char *, unsigned long, int, u32, unsigned
 long *, struct domain_setup_info *);
 static void copyout(int, u32, unsigned long *, unsigned long, void *,
 int);
-struct Exec *get_header(unsigned char *, unsigned long, struct Exec *);
+struct Exec *get_header(char *, unsigned long, struct Exec *);

int

(quoted diff) +1 -1
@@ -139,7 +139,7 @@ copyout(
  */
 struct Exec *
 get_header(
-    unsigned char *image,
+    char *image,
     unsigned long image_size,
     struct Exec *ehdr)
 {
Signature · 11 lines
-- 
Jerone Young
IBM Linux Technology Center
[email protected]
512-838-1157 (T/L: 678-1157)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 2 lines
Flávio Bruno Leitner <[email protected]>
[0EA2 7F40 4CF4 1E63 4AF6  33C0 3E10 E205 F251 EDDA]