diff options
author | Filipe Manana <fdmanana@suse.com> | 2022-02-17 12:12:08 +0000 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-03-14 13:13:52 +0100 |
commit | b2d9f2dc019fb739b8c0765ddcc184c31f7ae54b (patch) | |
tree | efd6108e74d75282bc465756bea8d501f615eeb8 /block/blk-stat.h | |
parent | 1f4613cdbe7739ce291554b316bff8e551383389 (diff) | |
download | linux-b2d9f2dc019fb739b8c0765ddcc184c31f7ae54b.tar.bz2 |
btrfs: deal with unexpected extent type during reflinking
Smatch complains about a possible dereference of a pointer that was not
initialized:
CC [M] fs/btrfs/reflink.o
CHECK fs/btrfs/reflink.c
fs/btrfs/reflink.c:533 btrfs_clone() error: potentially dereferencing uninitialized 'trans'.
This is because we are not dealing with the case where the type of a file
extent has an unexpected value (not regular, not prealloc and not inline),
in which case the transaction handle pointer is not initialized.
Such unexpected type should be impossible, except in case of some memory
corruption caused either by bad hardware or some software bug causing
something like a buffer overrun.
So ASSERT that if the extent type is neither regular nor prealloc, then
it must be inline. Bail out with -EUCLEAN and a warning in case it is
not. This silences smatch.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'block/blk-stat.h')
0 files changed, 0 insertions, 0 deletions