fs:fc_log replace magic number 7 with ARRAY_SIZE()
PATCH 1/1 fs:fc_log replace magic number 7 with ARRAY_SIZE()
Replace the hardcoded value 7 in put_fc_log() with ARRAY_SIZE. This improves maintainability by ensuring the loop adapts to changes in the buffer size.
--- fs/fs_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fs_context.c +1 -1
@@ -493,7 +493,7 @@ static void put_fc_log(struct fs_context *fc)if (log) {if (refcount_dec_and_test (&log->usage)) { fc->log.log =NULL ; -for (i =0 ; i <=7 ; i++) +for (i =0 ; i <ARRAY_SIZE (log->buffer) ; i++)if (log->need_free & (1 << i))kfree (log->buffer[i]);kfree (log);
Signature · 1 line
2.25.1
Re: [PATCH] fs: fc_log replace magic number 7 with ARRAY_SIZE()
Quoted 5 lines · Guo Weikang
Replace the hardcoded value
7input_fc_log()withARRAY_SIZE. This improves maintainability by ensuring the loop adapts to changes in the buffer size.
Applied to the vfs-6.14.misc branch of the vfs/vfs.git tree. Patches in the vfs-6.14.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs-6.14.misc
[1/1] fs:fc_log replace magic number 7 with ARRAY_SIZE()
https://git.kernel.org/vfs/vfs/c/6814aad4d6ce
Quoted 5 lines · Guo Weikang
Replace the hardcoded value
7input_fc_log()withARRAY_SIZE. This improves maintainability by ensuring the loop adapts to changes in the buffer size.Signed-off-by Guo Weikang <[email protected]>
Looks good. Feel free to add:
Honza
Quoted 20 lines
--- fs/fs_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/fs_context.c +1
-1@@ -493,7 +493,7 @@ static void put_fc_log(struct fs_context *fc)if (log) {if (refcount_dec_and_test (&log->usage)) { fc->log.log =NULL ; -for (i =0 ; i <=7 ; i++) +for (i =0 ; i <ARRAY_SIZE (log->buffer) ; i++)if (log->need_free & (1 << i))kfree (log->buffer[i]);kfree (log);Signature · 1 line
2.25.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR