diff options
| author | Purva Yeshi <purvayeshi550@gmail.com> | 2025-07-10 13:11:57 +0530 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-08-20 18:41:28 +0200 |
| commit | fa16caeee84f12379dcd9c5432fb0cc5a6fbfc3f (patch) | |
| tree | b429ab65e184d71171d9aa3832821cde9f800fcf /kernel | |
| parent | c626e9dab247bb1634975cbb0aad2a4ef80ee922 (diff) | |
md: dm-zoned-target: Initialize return variable r to avoid uninitialized use
[ Upstream commit 487767bff572d46f7c37ad846c4078f6d6c9cc55 ]
Fix Smatch-detected error:
drivers/md/dm-zoned-target.c:1073 dmz_iterate_devices()
error: uninitialized symbol 'r'.
Smatch detects a possible use of the uninitialized variable 'r' in
dmz_iterate_devices() because if dmz->nr_ddevs is zero, the loop is
skipped and 'r' is returned without being set, leading to undefined
behavior.
Initialize 'r' to 0 before the loop. This ensures that if there are no
devices to iterate over, the function still returns a defined value.
Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions
