From ebd150366f0852e7ebd32e7743e6a135138320a0 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 20 Sep 2021 10:24:30 +0200 Subject: cov: add explicit NULL pointer check Make obvious to coverity strcmp() is not getting NULL pointer. --- libdm/dm-tools/dmsetup.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libdm') diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c index f431f7509..f6d1ecf90 100644 --- a/libdm/dm-tools/dmsetup.c +++ b/libdm/dm-tools/dmsetup.c @@ -6426,9 +6426,10 @@ static const struct command *_find_command(const struct command *commands, { int i; - for (i = 0; commands[i].name; i++) - if (!strcmp(commands[i].name, name)) - return commands + i; + if (name) + for (i = 0; commands[i].name; i++) + if (!strcmp(commands[i].name, name)) + return commands + i; return NULL; } -- cgit v1.2.1