]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Fix debug build in userspace
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 14 Dec 2021 21:05:47 +0000 (16:05 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:18 +0000 (17:09 -0400)
This fixes some compiler warnings that only trigger in userspace - dead
code, a maybe uninitialed variable, a maybe null ptr passed to printk.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/btree_io.c
fs/bcachefs/dirent.c
fs/bcachefs/inode.c

index f01f7895294287c29c29d3fa950e37ae8196679f..5a678e6e993a3406a671f51753c6d9686d64b3aa 100644 (file)
@@ -560,7 +560,8 @@ enum btree_validate_ret {
                                                                        \
        switch (write) {                                                \
        case READ:                                                      \
-               bch_err(c, "%s", _buf2);                                \
+               if (_buf2)                                              \
+                       bch_err(c, "%s", _buf2);                        \
                                                                        \
                switch (type) {                                         \
                case BTREE_ERR_FIXABLE:                                 \
index a165d08c366830dc922c6831de55e30c29fa1113..6f699b736b348e366b6c1e43567cf7a65c78b8a4 100644 (file)
@@ -230,7 +230,7 @@ int bch2_dirent_rename(struct btree_trans *trans,
 {
        struct btree_iter src_iter = { NULL };
        struct btree_iter dst_iter = { NULL };
-       struct bkey_s_c old_src, old_dst;
+       struct bkey_s_c old_src, old_dst = bkey_s_c_null;
        struct bkey_i_dirent *new_src = NULL, *new_dst = NULL;
        struct bpos dst_pos =
                POS(dst_dir.inum, bch2_dirent_hash(dst_hash, dst_name));
index fb5ed3a07ad75673488f91bd0343b934e4c239c0..d9ccc7c063ac4149a6d4cb74876a341ad32f4022 100644 (file)
@@ -24,16 +24,6 @@ const char * const bch2_inode_opts[] = {
 };
 
 static const u8 byte_table[8] = { 1, 2, 3, 4, 6, 8, 10, 13 };
-static const u8 bits_table[8] = {
-       1  * 8 - 1,
-       2  * 8 - 2,
-       3  * 8 - 3,
-       4  * 8 - 4,
-       6  * 8 - 5,
-       8  * 8 - 6,
-       10 * 8 - 7,
-       13 * 8 - 8,
-};
 
 static int inode_decode_field(const u8 *in, const u8 *end,
                              u64 out[2], unsigned *out_bits)