summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/gpt.c
diff options
context:
space:
mode:
authorKarel Zak2015-08-05 12:59:16 +0200
committerKarel Zak2015-08-05 12:59:16 +0200
commite820595b8153235005e99c5ef1aeb7c12ecae403 (patch)
tree02550e9dfa646883b73436a37960ec314c0aac96 /libfdisk/src/gpt.c
parentlibfdisk: remove impossible condition [smatch scan] (diff)
downloadkernel-qcow2-util-linux-e820595b8153235005e99c5ef1aeb7c12ecae403.tar.gz
kernel-qcow2-util-linux-e820595b8153235005e99c5ef1aeb7c12ecae403.tar.xz
kernel-qcow2-util-linux-e820595b8153235005e99c5ef1aeb7c12ecae403.zip
libfdisk: (gpt) fix label pointer usage [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/gpt.c')
-rw-r--r--libfdisk/src/gpt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c
index 429dcc72d..b5bbbf705 100644
--- a/libfdisk/src/gpt.c
+++ b/libfdisk/src/gpt.c
@@ -1942,8 +1942,10 @@ static int gpt_verify_disklabel(struct fdisk_context *cxt)
assert(fdisk_is_label(cxt, GPT));
gpt = self_label(cxt);
+ if (!gpt)
+ return -EINVAL;
- if (!gpt || !gpt->bheader) {
+ if (!gpt->bheader) {
nerror++;
fdisk_warnx(cxt, _("Disk does not contain a valid backup header."));
}