From 1bed655a380eb3c44bf764e465ca40009db94d80 Mon Sep 17 00:00:00 2001 From: Sergi Granell Date: Wed, 25 Oct 2023 13:20:39 +0200 Subject: [PATCH] fat-module/ff: use MEM1-safe memset and memcpy --- source/fat-module/ff.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/source/fat-module/ff.c b/source/fat-module/ff.c index db36158..7c8e718 100644 --- a/source/fat-module/ff.c +++ b/source/fat-module/ff.c @@ -89,6 +89,8 @@ / Ignores duplicated directory separators in given path names. /---------------------------------------------------------------------------*/ +#include + #include "ff.h" /* FatFs configurations and declarations */ #include "diskio.h" /* Declarations of low level disk I/O functions */ @@ -517,30 +519,10 @@ static WCHAR LfnBuf[_MAX_LFN+1]; /*-----------------------------------------------------------------------*/ /* Copy memory to memory */ -static -void mem_cpy (void* dst, const void* src, UINT cnt) { - BYTE *d = (BYTE*)dst; - const BYTE *s = (const BYTE*)src; - -#if _WORD_ACCESS == 1 - while (cnt >= sizeof(int)) { - *(int*)d = *(int*)s; - d += sizeof(int); s += sizeof(int); - cnt -= sizeof(int); - } -#endif - while (cnt--) - *d++ = *s++; -} +#define mem_cpy (void)memcpy /* Fill memory */ -static -void mem_set (void* dst, int val, UINT cnt) { - BYTE *d = (BYTE*)dst; - - while (cnt--) - *d++ = (BYTE)val; -} +#define mem_set (void)memset /* Compare memory to memory */ static