summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.h
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2019-08-23 15:55:26 +0200
committerMike Snitzer <snitzer@redhat.com>2019-08-23 16:13:12 +0200
commit123d87d553e26f67e7be318c97c971b6b5fb1daa (patch)
tree874e61dd6809114c3b5186c2d7e0fc25a43b3662 /drivers/md/dm.h
parentdm table: fix invalid memory accesses with too high sector number (diff)
downloadlinux-123d87d553e26f67e7be318c97c971b6b5fb1daa.tar.xz
linux-123d87d553e26f67e7be318c97c971b6b5fb1daa.zip
dm: make dm_table_find_target return NULL
Currently, if we pass too high sector number to dm_table_find_target, it returns zeroed dm_target structure and callers test if the structure is zeroed with the macro dm_target_is_valid. However, returning NULL is common practice to indicate errors. This patch refactors the dm code, so that dm_table_find_target returns NULL and its callers test the returned value for NULL. The macro dm_target_is_valid is deleted. In alloc_targets, we no longer allocate an extra zeroed target. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm.h')
-rw-r--r--drivers/md/dm.h5
1 files changed, 0 insertions, 5 deletions
diff --git a/drivers/md/dm.h b/drivers/md/dm.h
index 0475673337f3..d7c4f6606b5f 100644
--- a/drivers/md/dm.h
+++ b/drivers/md/dm.h
@@ -86,11 +86,6 @@ struct target_type *dm_get_immutable_target_type(struct mapped_device *md);
int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t);
/*
- * To check the return value from dm_table_find_target().
- */
-#define dm_target_is_valid(t) ((t)->table)
-
-/*
* To check whether the target type is bio-based or not (request-based).
*/
#define dm_target_bio_based(t) ((t)->type->map != NULL)