Commit 0cf9c58
ext2: replace BUG_ON with WARN_ON_ONCE in ext2_get_blocks
If ext2_get_blocks() is called with maxblocks == 0, it currently triggers
a BUG_ON(), causing a kernel panic.
While this condition implies a logic error in the caller, a filesystem
should not crash the system due to invalid arguments.
Replace the BUG_ON() with a WARN_ON_ONCE() to provide a stack trace for
debugging, and return -EINVAL to handle the error gracefully.
Signed-off-by: Milos Nikic <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jan Kara <[email protected]>1 parent 6d942c8 commit 0cf9c58
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
641 | | - | |
| 641 | + | |
| 642 | + | |
642 | 643 | | |
643 | 644 | | |
644 | 645 | | |
| |||
0 commit comments