summaryrefslogtreecommitdiff
path: root/fs/fat/fat_write.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-07-10 10:29:31 -0400
committerTom Rini <trini@konsulko.com>2020-07-10 10:29:31 -0400
commit7068e523c18318443720166951f8cbfddfda1372 (patch)
treeb40102c0d264884df8e90941368a5fe948130c37 /fs/fat/fat_write.c
parent506d52308a2f5de48c2b9a08229fee9a0ee2842a (diff)
parentf4cef8e7585c268f05a8c39e368ca115c25e40d5 (diff)
downloadu-boot-7068e523c18318443720166951f8cbfddfda1372.tar.gz
Merge tag 'efi-2020-10-rc1-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efiWIP/10Jul2020
Pull request for UEFI sub-system for efi-2020-10-rc1 (2) Up to now UEFI variables where stored in U-Boot environment variables. Saving UEFI variables was not possible without saving the U-Boot environment variables. With this patch series file ubootefi.var in the EFI system partition is used for saving UEFI variables. Furthermore the UEFI variables are exposed for reading at runtime. Code corrections for UEFI secure boot are provided. A buffer overrun in the RSA library is fixed.
Diffstat (limited to 'fs/fat/fat_write.c')
-rw-r--r--fs/fat/fat_write.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index b16a39d3ff..a2682b5f46 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -500,8 +500,6 @@ flush_dir(fat_itr *itr)
nsects * mydata->sect_size);
}
-static __u8 tmpbuf_cluster[MAX_CLUSTSIZE] __aligned(ARCH_DMA_MINALIGN);
-
/*
* Read and modify data on existing and consecutive cluster blocks
*/
@@ -509,6 +507,7 @@ static int
get_set_cluster(fsdata *mydata, __u32 clustnum, loff_t pos, __u8 *buffer,
loff_t size, loff_t *gotsize)
{
+ static u8 *tmpbuf_cluster;
unsigned int bytesperclust = mydata->clust_size * mydata->sect_size;
__u32 startsect;
loff_t wsize;
@@ -518,6 +517,12 @@ get_set_cluster(fsdata *mydata, __u32 clustnum, loff_t pos, __u8 *buffer,
if (!size)
return 0;
+ if (!tmpbuf_cluster) {
+ tmpbuf_cluster = memalign(ARCH_DMA_MINALIGN, MAX_CLUSTSIZE);
+ if (!tmpbuf_cluster)
+ return -1;
+ }
+
assert(pos < bytesperclust);
startsect = clust_to_sect(mydata, clustnum);