master - libdm: check for null from pool strdup
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d4288c9bdfa104bef1e31185da0b773924218f35 Commit: d4288c9bdfa104bef1e31185da0b773924218f35 Parent: 422c7474ca97066ab92d145ac45bc4a9cd38e1b7 Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon Nov 16 00:00:32 2015 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Nov 16 01:16:09 2015 +0100
libdm: check for null from pool strdup
Unlikely to happen, but Coverity shown we may have possible derefer NULL pointer.
--- WHATS_NEW_DM | 1 + libdm/libdm-string.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-)
WHATS_NEW_DM +1 -0
@@ -1,5 +1,6 @@ Version 1.02.111 - ==================================== + Add missing check for allocation inside dm_split_lvm_name(). 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-string.c +4 -2
@@ -95,8 +95,10 @@ static char *_unquote(char *component)int dm_split_lvm_name (struct dm_pool *mem,const char *dmname,char **vgname,char **lvname,char **layer) { -if (mem) - *vgname =dm_pool_strdup (mem, dmname); +if (mem && !(*vgname =dm_pool_strdup (mem, dmname))) { +log_error ("Failed to duplicate dmname." ); +return 0 ; + }if (!*vgname)return 0 ;