[Concept,06/10] fs: Guard journal_head deref under FS_EXT4L

Message ID 20260418004014.1889749-7-sjg@u-boot.org
State New
Headers
Series efi-x86: boot Ubuntu live ISOs via U-Boot + BLS |

Commit Message

Simon Glass April 18, 2026, 12:40 a.m. UTC
  From: Simon Glass <sjg@chromium.org>

bh_cache_release_jbd() dereferences journal_head fields to clear the
buffer-to-journal link. When CONFIG_FS_EXT4L is disabled, the file
forward-declares struct journal_head with no definition and buffer_jbd()
expands to a literal 0, so the inner block is dead code. The compiler
still type-checks it, however, and rejects the dereference of an
incomplete type.

Wrap the loop body in #if IS_ENABLED(CONFIG_FS_EXT4L) so the function
reduces to an empty stub when ext4l is off, matching how buffer_jbd()
and bh2jh() work.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 fs/linux_fs.c | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/fs/linux_fs.c b/fs/linux_fs.c
index f922bed3b84..04f4c551f0b 100644
--- a/fs/linux_fs.c
+++ b/fs/linux_fs.c
@@ -243,6 +243,7 @@  void bh_cache_clear(struct block_device *bdev)
  */
 void bh_cache_release_jbd(struct block_device *bdev)
 {
+#if IS_ENABLED(CONFIG_FS_EXT4L)
 	int i;
 	struct bh_cache_entry *entry;
 
@@ -264,6 +265,7 @@  void bh_cache_release_jbd(struct block_device *bdev)
 			}
 		}
 	}
+#endif
 }
 
 /**