Skip to content
Snippets Groups Projects
Commit 40e21916 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Wolfgang Denk
Browse files

fat: root directory cluster only makes sense for FAT32


The root directory cluster field only exists in a FAT32 boot sector, so the
'root_cluster' variable in do_fat_read() contains garbage in case of FAT12/16.
Make it contain 0 instead as this is what is passed to get_vfatname() in that
case anyway.

Signed-off-by: default avatarSergei Shtylyov <sshtylyov@mvista.com>
parent 60b36f0f
No related branches found
No related tags found
No related merge requests found
...@@ -788,7 +788,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize, ...@@ -788,7 +788,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
int files = 0, dirs = 0; int files = 0, dirs = 0;
long ret = -1; long ret = -1;
int firsttime; int firsttime;
__u32 root_cluster; __u32 root_cluster = 0;
int rootdir_size = 0; int rootdir_size = 0;
int j; int j;
...@@ -797,12 +797,12 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize, ...@@ -797,12 +797,12 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
return -1; return -1;
} }
root_cluster = bs.root_cluster; if (mydata->fatsize == 32) {
root_cluster = bs.root_cluster;
if (mydata->fatsize == 32)
mydata->fatlength = bs.fat32_length; mydata->fatlength = bs.fat32_length;
else } else {
mydata->fatlength = bs.fat_length; mydata->fatlength = bs.fat_length;
}
mydata->fat_sect = bs.reserved; mydata->fat_sect = bs.reserved;
...@@ -904,9 +904,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize, ...@@ -904,9 +904,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
((dir_slot *)dentptr)->alias_checksum; ((dir_slot *)dentptr)->alias_checksum;
get_vfatname(mydata, get_vfatname(mydata,
(mydata->fatsize == 32) ? root_cluster,
root_cluster :
0,
do_fat_read_block, do_fat_read_block,
dentptr, l_name); dentptr, l_name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment