diff options
author | Karel Zak | 2012-01-31 15:03:27 +0100 |
---|---|---|
committer | Karel Zak | 2012-01-31 15:03:27 +0100 |
commit | 3be359813c8114a6ad40c473138324c3c9733278 (patch) | |
tree | b53fa301006602edb0924fe50f841faac884e102 /libblkid | |
parent | lscpu: dereferencing NULL pointer [coverity scan] (diff) | |
download | kernel-qcow2-util-linux-3be359813c8114a6ad40c473138324c3c9733278.tar.gz kernel-qcow2-util-linux-3be359813c8114a6ad40c473138324c3c9733278.tar.xz kernel-qcow2-util-linux-3be359813c8114a6ad40c473138324c3c9733278.zip |
libblkid: more robust idx usage [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid')
-rw-r--r-- | libblkid/src/superblocks/superblocks.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libblkid/src/superblocks/superblocks.c b/libblkid/src/superblocks/superblocks.c index e465eb154..d985adc05 100644 --- a/libblkid/src/superblocks/superblocks.c +++ b/libblkid/src/superblocks/superblocks.c @@ -440,10 +440,12 @@ static int superblocks_safeprobe(blkid_probe pr, struct blkid_chain *chn) count++; - if (idinfos[chn->idx]->usage & (BLKID_USAGE_RAID | BLKID_USAGE_CRYPTO)) + if (chn->idx >= 0 && + idinfos[chn->idx]->usage & (BLKID_USAGE_RAID | BLKID_USAGE_CRYPTO)) break; - if (!(idinfos[chn->idx]->flags & BLKID_IDINFO_TOLERANT)) + if (chn->idx >= 0 && + !(idinfos[chn->idx]->flags & BLKID_IDINFO_TOLERANT)) intol++; if (count == 1) { |