* [PATCH] btrfs: tree-checker: Fix bounds check in check_inode_extref()
@ 2025-10-08 15:08 Dan Carpenter
2025-10-08 21:27 ` Qu Wenruo
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-10-08 15:08 UTC (permalink / raw)
To: Qu Wenruo
Cc: Chris Mason, David Sterba, Filipe Manana, linux-btrfs,
linux-kernel, kernel-janitors
The parentheses for the unlikely() annotation were put in the wrong
place so it means that the condition is basically never true and the
bounds checking is skipped.
Fixes: aab9458b9f00 ("btrfs: tree-checker: add inode extref checks")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
fs/btrfs/tree-checker.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
index ca30b15ea452..c10b4c242acf 100644
--- a/fs/btrfs/tree-checker.c
+++ b/fs/btrfs/tree-checker.c
@@ -1797,7 +1797,7 @@ static int check_inode_extref(struct extent_buffer *leaf,
struct btrfs_inode_extref *extref = (struct btrfs_inode_extref *)ptr;
u16 namelen;
- if (unlikely(ptr + sizeof(*extref)) > end) {
+ if (unlikely(ptr + sizeof(*extref) > end)) {
inode_ref_err(leaf, slot,
"inode extref overflow, ptr %lu end %lu inode_extref size %zu",
ptr, end, sizeof(*extref));
--
2.51.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: tree-checker: Fix bounds check in check_inode_extref()
2025-10-08 15:08 [PATCH] btrfs: tree-checker: Fix bounds check in check_inode_extref() Dan Carpenter
@ 2025-10-08 21:27 ` Qu Wenruo
0 siblings, 0 replies; 2+ messages in thread
From: Qu Wenruo @ 2025-10-08 21:27 UTC (permalink / raw)
To: Dan Carpenter
Cc: Chris Mason, David Sterba, Filipe Manana, linux-btrfs,
linux-kernel, kernel-janitors
在 2025/10/9 01:38, Dan Carpenter 写道:
> The parentheses for the unlikely() annotation were put in the wrong
> place so it means that the condition is basically never true and the
> bounds checking is skipped.
>
> Fixes: aab9458b9f00 ("btrfs: tree-checker: add inode extref checks")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Nice catch.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/tree-checker.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
> index ca30b15ea452..c10b4c242acf 100644
> --- a/fs/btrfs/tree-checker.c
> +++ b/fs/btrfs/tree-checker.c
> @@ -1797,7 +1797,7 @@ static int check_inode_extref(struct extent_buffer *leaf,
> struct btrfs_inode_extref *extref = (struct btrfs_inode_extref *)ptr;
> u16 namelen;
>
> - if (unlikely(ptr + sizeof(*extref)) > end) {
> + if (unlikely(ptr + sizeof(*extref) > end)) {
> inode_ref_err(leaf, slot,
> "inode extref overflow, ptr %lu end %lu inode_extref size %zu",
> ptr, end, sizeof(*extref));
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-08 21:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08 15:08 [PATCH] btrfs: tree-checker: Fix bounds check in check_inode_extref() Dan Carpenter
2025-10-08 21:27 ` Qu Wenruo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox