From 39b1844c203cb57d9417b3dfcd00f6c5c65a1e16 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Mon, 10 Aug 2009 17:14:55 +0000 Subject: [PATCH] --- yaml --- r: 161751 b: refs/heads/master c: 3c15a68880023722fc794018768df556f438ae98 h: refs/heads/master i: 161749: 9b54282963b056db99369fd5944f0ec3f930af70 161747: 908db3b387f11e8da5b2342900f7f6aa33016b46 161743: 4d1b3f977d33cefd458c45e39c0cfec4c031429c v: v3 --- [refs] | 2 +- trunk/arch/powerpc/boot/mktree.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 3e32dd410034..e3684ed74d20 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 903444e4297264ec0959e886695911659edb425c +refs/heads/master: 3c15a68880023722fc794018768df556f438ae98 diff --git a/trunk/arch/powerpc/boot/mktree.c b/trunk/arch/powerpc/boot/mktree.c index c2baae0a3d89..e2ae24340fc8 100644 --- a/trunk/arch/powerpc/boot/mktree.c +++ b/trunk/arch/powerpc/boot/mktree.c @@ -36,7 +36,7 @@ typedef struct boot_block { } boot_block_t; #define IMGBLK 512 -char tmpbuf[IMGBLK]; +unsigned int tmpbuf[IMGBLK / sizeof(unsigned int)]; int main(int argc, char *argv[]) { @@ -95,13 +95,13 @@ int main(int argc, char *argv[]) /* Assume zImage is an ELF file, and skip the 64K header. */ - if (read(in_fd, tmpbuf, IMGBLK) != IMGBLK) { + if (read(in_fd, tmpbuf, sizeof(tmpbuf)) != sizeof(tmpbuf)) { fprintf(stderr, "%s is too small to be an ELF image\n", argv[1]); exit(4); } - if ((*(unsigned int *)tmpbuf) != htonl(0x7f454c46)) { + if (tmpbuf[0] != htonl(0x7f454c46)) { fprintf(stderr, "%s is not an ELF image\n", argv[1]); exit(4); } @@ -121,11 +121,11 @@ int main(int argc, char *argv[]) } while (nblks-- > 0) { - if (read(in_fd, tmpbuf, IMGBLK) < 0) { + if (read(in_fd, tmpbuf, sizeof(tmpbuf)) < 0) { perror("zImage read"); exit(5); } - cp = (unsigned int *)tmpbuf; + cp = tmpbuf; for (i = 0; i < sizeof(tmpbuf) / sizeof(unsigned int); i++) cksum += *cp++; if (write(out_fd, tmpbuf, sizeof(tmpbuf)) != sizeof(tmpbuf)) {