ext4:fix macro definition error of EXT4_DIRENT_HASH and EXT4_DIRENT_MINOR_HASH
PATCH 1/1 ext4:fix macro definition error of EXT4_DIRENT_HASH and EXT4_DIRENT_MINOR_HASH
the macro parameter "entry" of EXT4_DIRENT_HASH and EXT4_DIRENT_MINOR_HASH was not used, but rather the variable de was directly used, which may be a local variable inside a function that calls the macros
--- fs/ext4/ext4.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/ext4.h +2 -2
@@ -2338,9 +2338,9 @@ struct ext4_dir_entry_2 { ((struct ext4_dir_entry_hash *) \ (((void *)(entry)) + \ ((8 + (entry)->name_len + EXT4_DIR_ROUND) & ~EXT4_DIR_ROUND))) -#define EXT4_DIRENT_HASH (entry) le32_to_cpu(EXT4_DIRENT_HASHES(de)->hash) +#define EXT4_DIRENT_HASH (entry) le32_to_cpu(EXT4_DIRENT_HASHES(entry)->hash)#define EXT4_DIRENT_MINOR_HASH (entry) \ - le32_to_cpu(EXT4_DIRENT_HASHES(de)->minor_hash) + le32_to_cpu(EXT4_DIRENT_HASHES(entry)->minor_hash)static inline bool ext4_hash_in_dirent (const struct inode *inode) {
Signature · 1 line
2.7.4
Quoted 16 lines · carrion bent
the macro parameter "entry" of
EXT4_DIRENT_HASHandEXT4_DIRENT_MINOR_HASHwas not used, but rather the variable de was directly used, which may be a local variable inside a function that calls the macrosSigned-off-by carrion bent <[email protected]>--- fs/ext4/ext4.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/ext4/ext4.h +0
-0@@ -2338,9 +2338,9 @@ struct ext4_dir_entry_2 { ((struct ext4_dir_entry_hash *) \
fs/ext4/ext4.h struct ext4_dir_entry_2 { · line 2346
Quoted 10 lines
fs/ext4/ext4.h +2
-2(((void *)(entry)) + \ ((8 + (entry)->name_len + EXT4_DIR_ROUND) & ~EXT4_DIR_ROUND))) -#define EXT4_DIRENT_HASH (entry) le32_to_cpu(EXT4_DIRENT_HASHES(de)->hash) +#define EXT4_DIRENT_HASH (entry) le32_to_cpu(EXT4_DIRENT_HASHES(entry)->hash)#define EXT4_DIRENT_MINOR_HASH (entry) \ - le32_to_cpu(EXT4_DIRENT_HASHES(de)->minor_hash) + le32_to_cpu(EXT4_DIRENT_HASHES(entry)->minor_hash)static inline bool ext4_hash_in_dirent (const struct inode *inode) {
Thanks! Can you call out explicitly in the commit message that (fortunately) all callers pass in 'de', so this bug didn't have an effect? Also, in the commit title, there needs to be a space after "ext4:". Otherwise this patch looks good to me.
- Eric
PATCH v2 1/1 ext4: fix macro definition error of EXT4_DIRENT_HASH and EXT4_DIRENT_MINOR_HASH
In reply to carrion bent the macro parameter 'entry' of EXT4_DIRENT_HASH and EXT4_DIRENT_MINOR_HASH was not used, but rather the variable 'de' was directly used, which may be a local variable inside a function that calls the macros. Fortunately, all callers have passed in 'de' so far, so this bug didn't have an effect.
--- fs/ext4/ext4.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/ext4.h +2 -2
@@ -2338,9 +2338,9 @@ struct ext4_dir_entry_2 { ((struct ext4_dir_entry_hash *) \ (((void *)(entry)) + \ ((8 + (entry)->name_len + EXT4_DIR_ROUND) & ~EXT4_DIR_ROUND))) -#define EXT4_DIRENT_HASH (entry) le32_to_cpu(EXT4_DIRENT_HASHES(de)->hash) +#define EXT4_DIRENT_HASH (entry) le32_to_cpu(EXT4_DIRENT_HASHES(entry)->hash)#define EXT4_DIRENT_MINOR_HASH (entry) \ - le32_to_cpu(EXT4_DIRENT_HASHES(de)->minor_hash) + le32_to_cpu(EXT4_DIRENT_HASHES(entry)->minor_hash)static inline bool ext4_hash_in_dirent (const struct inode *inode) {
Signature · 1 line
2.7.4
Jan Kara
reviewerRe: [PATCH v2] ext4: fix macro definition error of EXT4_DIRENT_HASH and EXT4_DIRENT_MINOR_HASH
Quoted 8 lines · carrion bent
the macro parameter 'entry' of
EXT4_DIRENT_HASHandEXT4_DIRENT_MINOR_HASHwas not used, but rather the variable 'de' was directly used, which may be a local variable inside a function that calls the macros. Fortunately, all callers have passed in 'de' so far, so this bug didn't have an effect.Signed-off-by carrion bent <[email protected]>
Ted, this seems to have fallen through the cracks. The bug in the macro is really nasty trap...
Honza
Quoted 24 lines
--- fs/ext4/ext4.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/ext4/ext4.h +2
-2@@ -2338,9 +2338,9 @@ struct ext4_dir_entry_2 { ((struct ext4_dir_entry_hash *) \ (((void *)(entry)) + \ ((8 + (entry)->name_len + EXT4_DIR_ROUND) & ~EXT4_DIR_ROUND))) -#define EXT4_DIRENT_HASH (entry) le32_to_cpu(EXT4_DIRENT_HASHES(de)->hash) +#define EXT4_DIRENT_HASH (entry) le32_to_cpu(EXT4_DIRENT_HASHES(entry)->hash)#define EXT4_DIRENT_MINOR_HASH (entry) \ - le32_to_cpu(EXT4_DIRENT_HASHES(de)->minor_hash) + le32_to_cpu(EXT4_DIRENT_HASHES(entry)->minor_hash)static inline bool ext4_hash_in_dirent (const struct inode *inode) {Signature · 1 line
2.7.4
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Re: [PATCH v2] ext4: fix macro definition error of EXT4_DIRENT_HASH and EXT4_DIRENT_MINOR_HASH
In reply to carrion bentQuoted 8 lines · carrion bent
the macro parameter 'entry' of
EXT4_DIRENT_HASHandEXT4_DIRENT_MINOR_HASHwas not used, but rather the variable 'de' was directly used, which may be a local variable inside a function that calls the macros. Fortunately, all callers have passed in 'de' so far, so this bug didn't have an effect.[...]
Applied, thanks!
[1/1] ext4: fix macro definition error of EXT4_DIRENT_HASH and EXT4_DIRENT_MINOR_HASH
commit: f67fbacd923f280c55b9e26e49650331446ef335
Best regards,
Signature · 1 line
Theodore Ts'o <[email protected]>