From 1c96b61d4076b3821d855ddf589db80c18d59ee9 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 2 Apr 2013 21:15:14 -0700 Subject: [PATCH] iso9660: use generic get_le32() accessor in SUSP/Rock Ridge code Use the new get_le32() accessor in the SUSP/Rock Ridge code. Signed-off-by: H. Peter Anvin Cc: Thomas Schmitt --- core/fs/iso9660/susp_rr.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/core/fs/iso9660/susp_rr.c b/core/fs/iso9660/susp_rr.c index e758586f..bbeae975 100644 --- a/core/fs/iso9660/susp_rr.c +++ b/core/fs/iso9660/susp_rr.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "iso9660_fs.h" #else /* ! Isolinux_rockridge_in_libisofS */ @@ -99,15 +100,9 @@ static int susp_rr_is_out_of_mem(void *pt) } -static uint32_t susp_rr_read_lsb(uint8_t *buf, int bytes) +static uint32_t susp_rr_read_lsb32(const void *buf) { - int i; - uint32_t ret = 0; - - for (i = 0; i < bytes; i++) { - ret += ((uint32_t) buf[i]) << (i * 8); - } - return ret; + return get_le32(buf); } @@ -274,9 +269,9 @@ static int susp_rr_iterate(struct susp_rr_iter *iter, char **pos_pt) } /* Register address data of next Continuation Area */ u_entry = (uint8_t *) entries; - iter->next_lba = susp_rr_read_lsb(u_entry + 4, 4); - iter->next_offset = susp_rr_read_lsb(u_entry + 12, 4); - iter->next_length = susp_rr_read_lsb(u_entry + 20, 4); + iter->next_lba = susp_rr_read_lsb32(u_entry + 4); + iter->next_offset = susp_rr_read_lsb32(u_entry + 12); + iter->next_length = susp_rr_read_lsb32(u_entry + 20); } *pos_pt = entries; @@ -461,7 +456,7 @@ int susp_rr_check_signatures(struct fs_info *fs, int flag) #endif /* Isolinux_rockridge_in_libisofS */ /* Obtain first dir_rec of root directory */ - lba = susp_rr_read_lsb(((uint8_t *) &(sbi->root)) + 2, 4); + lba = susp_rr_read_lsb32(((uint8_t *) &(sbi->root)) + 2); dir_rec = (char *) get_cache(fs->fs_dev, lba); if (dir_rec == NULL) goto no_susp; -- 2.11.4.GIT