projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3212a8f
)
fs: fc_log replace magic number 7 with ARRAY_SIZE()
author
Guo Weikang
<guoweikang.kernel@gmail.com>
Mon, 2 Dec 2024 08:11:45 +0000
(16:11 +0800)
committer
Christian Brauner
<brauner@kernel.org>
Sun, 22 Dec 2024 10:29:52 +0000
(11:29 +0100)
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 <guoweikang.kernel@gmail.com>
Link:
https://lore.kernel.org/r/20241202081146.1031780-1-guoweikang.kernel@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/fs_context.c
patch
|
blob
|
blame
|
history
diff --git
a/fs/fs_context.c
b/fs/fs_context.c
index 98589aae52085c82d4e8951ca63be928cb33cec8..582d33e8111739402d38dc9fc268e7d14ced3c49 100644
(file)
--- a/
fs/fs_context.c
+++ b/
fs/fs_context.c
@@
-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);