Commit 487767bf authored by Purva Yeshi's avatar Purva Yeshi Committed by Mikulas Patocka
Browse files

md: dm-zoned-target: Initialize return variable r to avoid uninitialized use



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: default avatarPurva Yeshi <purvayeshi550@gmail.com>
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
parent bdf253d5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment