diff options
author | Mike Snitzer <snitzer@kernel.org> | 2022-07-05 16:12:27 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2022-07-07 11:49:34 -0400 |
commit | 564b5c5476cdb71b717340897b2b50f9c45df158 (patch) | |
tree | 75ff585908371d35a6142b3c8b9612c1cb8ac3a4 /drivers/md/dm-zone.c | |
parent | 2aec377a29250b942f14d3c16d49783da3e9df11 (diff) |
dm table: audit all dm_table_get_target() callers
All callers of dm_table_get_target() are expected to do proper bounds
checking on the index they pass.
Move dm_table_get_target() to dm-core.h to make it extra clear that only
DM core code should be using it. Switch it to be inlined while at it.
Standardize all DM core callers to use the same for loop pattern and
make associated variables as local as possible. Rename some variables
(e.g. s/table/t/ and s/tgt/ti/) along the way.
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md/dm-zone.c')
-rw-r--r-- | drivers/md/dm-zone.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c index 16dc9ec4bb11..444ca81f4596 100644 --- a/drivers/md/dm-zone.c +++ b/drivers/md/dm-zone.c @@ -275,11 +275,8 @@ static int device_not_zone_append_capable(struct dm_target *ti, static bool dm_table_supports_zone_append(struct dm_table *t) { - struct dm_target *ti; - unsigned int i; - - for (i = 0; i < t->num_targets; i++) { - ti = dm_table_get_target(t, i); + for (unsigned int i = 0; i < t->num_targets; i++) { + struct dm_target *ti = dm_table_get_target(t, i); if (ti->emulate_zone_append) return false; |