summaryrefslogtreecommitdiffstats
path: root/disk/part_iso.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2016-04-11 16:16:14 +0200
committerTom Rini <trini@konsulko.com>2016-04-18 17:11:33 -0400
commitef9e6de5409535bde164f087c31ac865800cbf14 (patch)
tree5c8740606982f880608a7ef563c570b371ad7970 /disk/part_iso.c
parentc020d355c45ed40fe12af72ae5487527167fafd5 (diff)
downloadtalos-obmc-uboot-ef9e6de5409535bde164f087c31ac865800cbf14.tar.gz
talos-obmc-uboot-ef9e6de5409535bde164f087c31ac865800cbf14.zip
iso: Make little endian and 64bit safe
The iso partition table implementation has a few endian and 64bit problems. Clean it up a bit to become endian and bitness safe. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'disk/part_iso.c')
-rw-r--r--disk/part_iso.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/disk/part_iso.c b/disk/part_iso.c
index 2114faf64b..b7a538143e 100644
--- a/disk/part_iso.c
+++ b/disk/part_iso.c
@@ -58,11 +58,9 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
ppr->stand_ident, dev_desc->devnum, part_num);
return (-1);
}
- lastsect= ((ppr->firstsek_LEpathtab1_LE & 0x000000ff)<<24) +
- ((ppr->firstsek_LEpathtab1_LE & 0x0000ff00)<< 8) +
- ((ppr->firstsek_LEpathtab1_LE & 0x00ff0000)>> 8) +
- ((ppr->firstsek_LEpathtab1_LE & 0xff000000)>>24) ;
- info->blksz=ppr->secsize_BE; /* assuming same block size for all entries */
+ lastsect = le32_to_cpu(ppr->firstsek_LEpathtab1_LE);
+ /* assuming same block size for all entries */
+ info->blksz = be16_to_cpu(ppr->secsize_BE);
PRINTF(" Lastsect:%08lx\n",lastsect);
for(i=blkaddr;i<lastsect;i++) {
PRINTF("Reading block %d\n", i);
@@ -95,7 +93,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
chksum=0;
chksumbuf = (unsigned short *)tmpbuf;
for(i=0;i<0x10;i++)
- chksum+=((chksumbuf[i] &0xff)<<8)+((chksumbuf[i] &0xff00)>>8);
+ chksum += le16_to_cpu(chksumbuf[i]);
if(chksum!=0) {
if(verb)
printf("** Checksum Error in booting catalog validation entry on %d:%d **\n",
OpenPOWER on IntegriCloud