summaryrefslogtreecommitdiffstats
path: root/fs/fat/fat.c
diff options
context:
space:
mode:
authorBryan Wu <bryan.wu@analog.com>2009-01-02 20:47:45 -0500
committerWolfgang Denk <wd@denx.de>2009-01-24 02:03:39 +0100
commit7e4b9b4f6f43838fad3ad72c029a3d7fc7c7d48c (patch)
tree15e3bff16bca717affc4631f8b4e513e2c57765e /fs/fat/fat.c
parent68f8718df2ed4c2f43031407ccf6cfa81125dddc (diff)
downloadbootable_bootloader_goldelico_gta04-7e4b9b4f6f43838fad3ad72c029a3d7fc7c7d48c.zip
bootable_bootloader_goldelico_gta04-7e4b9b4f6f43838fad3ad72c029a3d7fc7c7d48c.tar.gz
bootable_bootloader_goldelico_gta04-7e4b9b4f6f43838fad3ad72c029a3d7fc7c7d48c.tar.bz2
fat: fix unaligned errors
A couple of buffers in the fat code are declared as an array of bytes. But it is then cast up to a structure with 16bit and 32bit members. Since GCC assumes structure alignment here, we have to force the buffers to be aligned according to the structure usage. Signed-off-by: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'fs/fat/fat.c')
-rw-r--r--fs/fat/fat.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index a9dde7d..28c7805 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -434,7 +434,8 @@ slot2str(dir_slot *slotptr, char *l_name, int *idx)
* into 'retdent'
* Return 0 on success, -1 otherwise.
*/
-__u8 get_vfatname_block[MAX_CLUSTSIZE];
+__attribute__ ((__aligned__(__alignof__(dir_entry))))
+__u8 get_vfatname_block[MAX_CLUSTSIZE];
static int
get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
dir_entry *retdent, char *l_name)
@@ -520,6 +521,7 @@ mkcksum(const char *str)
* Get the directory entry associated with 'filename' from the directory
* starting at 'startsect'
*/
+__attribute__ ((__aligned__(__alignof__(dir_entry))))
__u8 get_dentfromdir_block[MAX_CLUSTSIZE];
static dir_entry *get_dentfromdir (fsdata * mydata, int startsect,
char *filename, dir_entry * retdent,
@@ -725,8 +727,8 @@ read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
return -1;
}
-
-__u8 do_fat_read_block[MAX_CLUSTSIZE]; /* Block buffer */
+__attribute__ ((__aligned__(__alignof__(dir_entry))))
+__u8 do_fat_read_block[MAX_CLUSTSIZE];
long
do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
int dols)