From 041f0af3668e037f465d0e80ea5561fb3fbaa7d0 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 21 Jan 2021 00:23:33 +0100 Subject: fs: fat: structure for name and extension The short name and extension of FAT files are stored in adjacent fields of the directory entry. For some operations like calculating a checksum or copying both fields it is preferable to treat both as one structure. Change the definition of the directory entry structure to include a structure comprising the name and the extension field. This resolves Coverity CID 316357, CID 316350, CID 316348. Signed-off-by: Heinrich Schuchardt --- include/fat.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/fat.h b/include/fat.h index b9f273f381..bd8e450b33 100644 --- a/include/fat.h +++ b/include/fat.h @@ -132,8 +132,13 @@ typedef struct volume_info #define CASE_LOWER_BASE 8 /* base (name) is lower case */ #define CASE_LOWER_EXT 16 /* extension is lower case */ +struct nameext { + char name[8]; + char ext[3]; +}; + typedef struct dir_entry { - char name[8],ext[3]; /* Name and extension */ + struct nameext nameext; /* Name and extension */ __u8 attr; /* Attribute bits */ __u8 lcase; /* Case for name and ext (CASE_LOWER_x) */ __u8 ctime_ms; /* Creation time, milliseconds */ -- cgit