From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Williams Date: Mon, 07 May 2012 19:10:08 -0700 Subject: [U-Boot] [PATCH 1/1] fat: FAT sector offsets overflow on large disks and/or FAT partitions In-Reply-To: <4FA1EAC5.8000003@cavium.com> References: <4FA1EAC5.8000003@cavium.com> Message-ID: <4FA88080.8040900@cavium.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Any comments on this patch? On 05/02/2012 07:17 PM, Aaron Williams wrote: > This patch fixes several issues where sector offsets can overflow due to > being limited to 16-bits. There are many cases which can cause an > overflow, including large FAT32 partitions and partitions that start at > a sufficiently large offset on the storage device. > > Numerous issues were observed and fixed when a 64GB FAT32 filesystem was > accessed due to truncation. > > Signed-off-by: Aaron Williams > --- > include/fat.h | 10 +++++----- > 1 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/include/fat.h b/include/fat.h > index 4c92442..7215628 100644 > --- a/include/fat.h > +++ b/include/fat.h > @@ -178,12 +178,12 @@ typedef struct dir_slot { > typedef struct { > __u8 *fatbuf; /* Current FAT buffer */ > int fatsize; /* Size of FAT in bits */ > - __u16 fatlength; /* Length of FAT in sectors */ > - __u16 fat_sect; /* Starting sector of the FAT */ > - __u16 rootdir_sect; /* Start sector of root directory */ > - __u16 sect_size; /* Size of sectors in bytes */ > + __u32 fat_sect; /* Starting sector of the FAT */ > + __u32 rootdir_sect; /* Start sector of root directory */ > + __u32 fatlength; /* Length of FAT in sectors */ > __u16 clust_size; /* Size of clusters in sectors */ > - short data_begin; /* The sector of the first cluster, can be negative */ > + __u16 sect_size; /* Size of sectors in bytes */ > + int data_begin; /* The sector of the first cluster, can be negative */ > int fatbufnum; /* Used by get_fatent, init to -1 */ > } fsdata; > -- Aaron Williams Software Engineer Cavium, Inc. (408) 943-7198 (510) 789-8988 (cell)