master - libdm: add test for dm_task_get_message_response()
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3cadc1c87e4f1f6cede3895a7f7f28f37eaf9648 Commit: 3cadc1c87e4f1f6cede3895a7f7f28f37eaf9648 Parent: 84303dc17aeca9773d5644e4beccc267ab7a3153 Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon Nov 9 09:50:46 2015 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Nov 9 10:19:19 2015 +0100
libdm: add test for dm_task_get_message_response()
Coverity notices dm_task_get_message_response() result should be checked for NULL which should not be passed to dm_pool_strdup().
--- WHATS_NEW_DM | 1 + libdm/libdm-stats.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletions(-)
WHATS_NEW_DM +1 -0
@@ -1,5 +1,6 @@ Version 1.02.111 - ==================================== + Test dm_task_get_message_response for !NULL in dm_stats_print_region(). Add checks for failing dm_stats_create() in dmsetup. Add missing fifo close when failed to initialize client connection.
libdm/libdm-stats.c +5 -1
@@ -1259,6 +1259,7 @@ char *dm_stats_print_region(struct dm_stats *dms, uint64_t region_id, {char *resp =NULL ;struct dm_task *dmt =NULL ; +const char *response;if (!_stats_bound (dms)) return_0;
@@ -1269,7 +1270,10 @@ char *dm_stats_print_region(struct dm_stats *dms, uint64_t region_id,if (!dmt) return_0; - resp =dm_pool_strdup (dms->mem,dm_task_get_message_response (dmt)); +if (!(response =dm_task_get_message_response (dmt))) + return_0; + + resp =dm_pool_strdup (dms->mem, response);dm_task_destroy (dmt);if (!resp)