bcachefs: Initialize padding space after alloc bkey
authorJustin Husted <sigstop@gmail.com>
Sat, 12 Oct 2019 00:20:30 +0000 (17:20 -0700)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:30 +0000 (17:08 -0400)
commite3728b50034504e5e64604d72896973374cb1fa5
tree59b558932576462c23bc9fac0c87d5d769bf33d8
parente219965586b0e18a12e12fdf37f26eb74bb17bcd
bcachefs: Initialize padding space after alloc bkey

Packed bkeys are padded up to 64 bit alignment, but the alloc bkey type
was not clearing the pad bytes after the last data byte. This left the
key possibly containing some random garbage at the end.

This problem was found using valgrind.

This patch also changes a path with the inode bkey to clear in the same
way.

Signed-off-by: Justin Husted <sigstop@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/alloc_background.c
fs/bcachefs/inode.c
fs/bcachefs/util.h