diff options
author | Tien Fong Chee <tfchee@altera.com> | 2016-07-27 23:08:56 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-11-28 20:09:45 -0500 |
commit | 7aa1a6b71c9af4651f6b3a164c84096a84d24285 (patch) | |
tree | b47cc2339c644563f59ffb2474c6b6105af76cbe /fs/fat/fat_write.c | |
parent | e94793c844a40606252f2e3f6428063e057b3fd2 (diff) | |
download | u-boot-7aa1a6b71c9af4651f6b3a164c84096a84d24285.tar.gz u-boot-7aa1a6b71c9af4651f6b3a164c84096a84d24285.tar.bz2 u-boot-7aa1a6b71c9af4651f6b3a164c84096a84d24285.zip |
fs/fat/fatwrite: Local variable as buffer to store dir_slot entries
fill_dir_slot use get_contents_vfatname_block as a temporary buffer for
constructing a list of dir_slot entries. To save the memory and providing
correct type of memory for above usage, a local buffer with accurate size
declaration is introduced.
The local array size 640 is used because for long file name entry,
each entry use 32 bytes, one entry can store up to 13 characters.
The maximum number of entry possible is 20. So, total size is
32*20=640bytes.
Signed-off-by: Genevieve Chan <ccheauya@altera.com>
Signed-off-by: Tien Fong Chee <tfchee@altera.com>
Diffstat (limited to 'fs/fat/fat_write.c')
-rw-r--r-- | fs/fat/fat_write.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index 0583af310a..40a3860e47 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -327,7 +327,8 @@ static void flush_dir_table(fsdata *mydata, dir_entry **dentptr); static void fill_dir_slot(fsdata *mydata, dir_entry **dentptr, const char *l_name) { - dir_slot *slotptr = (dir_slot *)get_contents_vfatname_block; + __u8 temp_dir_slot_buffer[MAX_LFN_SLOT * sizeof(dir_slot)]; + dir_slot *slotptr = (dir_slot *)temp_dir_slot_buffer; __u8 counter = 0, checksum; int idx = 0, ret; |