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 <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>
This commit is contained in:
Guo Weikang 2024-12-02 16:11:45 +08:00 committed by Christian Brauner
parent c0a924f06e
commit 6814aad4d6
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -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);