Re: [PATCH 06/12] btrfs: change lockdep class size check using ks->names

David Sterba
2022-02-08T19:06:50Z

On Tue, Feb 08, 2022 at 10:42:02AM -0800, Namhyung Kim wrote:
> With upcoming lock tracepoints config, it'd allow some lockdep
> annotation code without enabling CONFIG_LOCKDEP actually. In that
> config, size of the struct lock_class_key would be 0.
>
> But it'd cause divide-by-zero in btrfs_set_buffer_lockdep_class() due
> to ARRAY_SIZE macro. Let's change it to use ks->names[] instead. It
> should have the same size as with ks->keys[].
>
> Cc: Chris Mason <clm@fb.com>
> Cc: Josef Bacik <josef@toxicpanda.com>
> Cc: David Sterba <dsterba@suse.com>
> Cc: linux-btrfs@vger.kernel.org
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Acked-by: David Sterba <dsterba@suse.com>