From f3438ee8011e262d081534842f83a666c33cc0a3 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 1 Jul 2014 12:32:25 +0200 Subject: [PATCH] libblkid: fix probe_ddf() [clang-analyze] Signed-off-by: Karel Zak --- libblkid/src/superblocks/ddf_raid.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libblkid/src/superblocks/ddf_raid.c b/libblkid/src/superblocks/ddf_raid.c index b907a9f8ce..fc2c39d3e5 100644 --- a/libblkid/src/superblocks/ddf_raid.c +++ b/libblkid/src/superblocks/ddf_raid.c @@ -110,12 +110,11 @@ static int probe_ddf(blkid_probe pr, buf = blkid_probe_get_buffer(pr, lba << 9, sizeof(ddf->signature)); - if (!buf) { - if (errno) - return -errno; - if (memcmp(buf, &ddf->signature, 4)) - return 1; - } + if (!buf) + return errno ? -errno : 1; + + if (memcmp(buf, &ddf->signature, 4) != 0) + return 1; } blkid_probe_strncpy_uuid(pr, ddf->guid, sizeof(ddf->guid)); -- 2.47.2