Skip to content

Commit 4db9f52

Browse files
guoweikangbrauner
authored andcommitted
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. Signed-off-by: Guo Weikang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 3212a8f commit 4db9f52

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/fs_context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ static void put_fc_log(struct fs_context *fc)
493493
if (log) {
494494
if (refcount_dec_and_test(&log->usage)) {
495495
fc->log.log = NULL;
496-
for (i = 0; i <= 7; i++)
496+
for (i = 0; i < ARRAY_SIZE(log->buffer) ; i++)
497497
if (log->need_free & (1 << i))
498498
kfree(log->buffer[i]);
499499
kfree(log);

0 commit comments

Comments
 (0)