From 6642826e23b5ef37c93fd3de080f57499d18e5ec Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Fri, 14 May 2021 20:02:44 -0400 Subject: bcachefs: properly initialize used values - Ensure the second key value in bch_hash_info is initialized to zero if the info type is of type BCH_STR_HASH_SIPHASH. - Initialize the possibly returned value in bch2_inode_create. Assuming bch2_btree_iter_peek returns bkey_s_c_null, the uninitialized value of ret could be returned to the user as an error pointer. - Fix compiler warning in initialization of bkey_s_c_stripe fs/bcachefs/buckets.c:1646:35: warning: suggest braces around initialization of subobject [-Wmissing-braces] struct bkey_s_c_stripe new_s = { NULL }; ^~~~ Signed-off-by: Dan Robertson --- fs/bcachefs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/bcachefs/inode.c') diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c index dfde5ba3f1b7..c5892e42aaec 100644 --- a/fs/bcachefs/inode.c +++ b/fs/bcachefs/inode.c @@ -478,7 +478,7 @@ struct btree_iter *bch2_inode_create(struct btree_trans *trans, struct btree_iter *iter = NULL; struct bkey_s_c k; u64 min, max, start, pos, *hint; - int ret; + int ret = 0; u64 cpu = raw_smp_processor_id(); unsigned bits = (c->opts.inodes_32bit -- cgit v1.2.3