diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2009-08-10 13:14:55 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-08-19 20:29:30 -0400 |
commit | 3c15a68880023722fc794018768df556f438ae98 (patch) | |
tree | 07c9f4160a44799dafce855ad16c84064557c467 /arch/powerpc/boot | |
parent | 903444e4297264ec0959e886695911659edb425c (diff) |
powerpc: use consistent types in mktree
gcc v4.4 currently produces this build warning:
arch/powerpc/boot/mktree.c: In function 'main':
arch/powerpc/boot/mktree.c:104: warning: dereferencing type-punned pointer will break strict-aliasing rules
tmpbuf is only used as an array of unsigned ints, so declare it that way.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r-- | arch/powerpc/boot/mktree.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/powerpc/boot/mktree.c b/arch/powerpc/boot/mktree.c index c2baae0a3d89..e2ae24340fc8 100644 --- a/arch/powerpc/boot/mktree.c +++ b/arch/powerpc/boot/mktree.c | |||
@@ -36,7 +36,7 @@ typedef struct boot_block { | |||
36 | } boot_block_t; | 36 | } boot_block_t; |
37 | 37 | ||
38 | #define IMGBLK 512 | 38 | #define IMGBLK 512 |
39 | char tmpbuf[IMGBLK]; | 39 | unsigned int tmpbuf[IMGBLK / sizeof(unsigned int)]; |
40 | 40 | ||
41 | int main(int argc, char *argv[]) | 41 | int main(int argc, char *argv[]) |
42 | { | 42 | { |
@@ -95,13 +95,13 @@ int main(int argc, char *argv[]) | |||
95 | 95 | ||
96 | /* Assume zImage is an ELF file, and skip the 64K header. | 96 | /* Assume zImage is an ELF file, and skip the 64K header. |
97 | */ | 97 | */ |
98 | if (read(in_fd, tmpbuf, IMGBLK) != IMGBLK) { | 98 | if (read(in_fd, tmpbuf, sizeof(tmpbuf)) != sizeof(tmpbuf)) { |
99 | fprintf(stderr, "%s is too small to be an ELF image\n", | 99 | fprintf(stderr, "%s is too small to be an ELF image\n", |
100 | argv[1]); | 100 | argv[1]); |
101 | exit(4); | 101 | exit(4); |
102 | } | 102 | } |
103 | 103 | ||
104 | if ((*(unsigned int *)tmpbuf) != htonl(0x7f454c46)) { | 104 | if (tmpbuf[0] != htonl(0x7f454c46)) { |
105 | fprintf(stderr, "%s is not an ELF image\n", argv[1]); | 105 | fprintf(stderr, "%s is not an ELF image\n", argv[1]); |
106 | exit(4); | 106 | exit(4); |
107 | } | 107 | } |
@@ -121,11 +121,11 @@ int main(int argc, char *argv[]) | |||
121 | } | 121 | } |
122 | 122 | ||
123 | while (nblks-- > 0) { | 123 | while (nblks-- > 0) { |
124 | if (read(in_fd, tmpbuf, IMGBLK) < 0) { | 124 | if (read(in_fd, tmpbuf, sizeof(tmpbuf)) < 0) { |
125 | perror("zImage read"); | 125 | perror("zImage read"); |
126 | exit(5); | 126 | exit(5); |
127 | } | 127 | } |
128 | cp = (unsigned int *)tmpbuf; | 128 | cp = tmpbuf; |
129 | for (i = 0; i < sizeof(tmpbuf) / sizeof(unsigned int); i++) | 129 | for (i = 0; i < sizeof(tmpbuf) / sizeof(unsigned int); i++) |
130 | cksum += *cp++; | 130 | cksum += *cp++; |
131 | if (write(out_fd, tmpbuf, sizeof(tmpbuf)) != sizeof(tmpbuf)) { | 131 | if (write(out_fd, tmpbuf, sizeof(tmpbuf)) != sizeof(tmpbuf)) { |