Skip to content

Commit

Permalink
reiserfs: Remove VLA from fs/reiserfs/reiserfs.h
Browse files Browse the repository at this point in the history
Remove Variable Length Array from fs/reiserfs/reiserfs.h. EMPTY_DIR_SIZE
is used as an array size and as it is using strlen() it need not be
evaluated at compile time. Change it's definition to use sizeof() to
force evaluation of array length at compile time.

Signed-off-by: Kyle Spiers <kyle@spiers.me>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Kyle Spiers authored and Jan Kara committed Mar 9, 2018
1 parent 785dffe commit a9cee17
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/reiserfs/reiserfs.h
Original file line number Diff line number Diff line change
@@ -1916,7 +1916,7 @@ struct reiserfs_de_head {

/* empty directory contains two entries "." and ".." and their headers */
#define EMPTY_DIR_SIZE \
(DEH_SIZE * 2 + ROUND_UP (strlen (".")) + ROUND_UP (strlen ("..")))
(DEH_SIZE * 2 + ROUND_UP (sizeof(".") - 1) + ROUND_UP (sizeof("..") - 1))

/* old format directories have this size when empty */
#define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3)

0 comments on commit a9cee17

Please sign in to comment.