]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
setarch: avoid NULL dereference [coverity check]
authorKarel Zak <kzak@redhat.com>
Tue, 28 May 2019 11:08:21 +0000 (13:08 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 28 May 2019 11:08:21 +0000 (13:08 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/setarch.c

index f84e90b5bf5c172aca2c55de5fad7e26d7836c46..1a2ae1b68ccce9645643f24632c5174911ab6841 100644 (file)
@@ -246,7 +246,7 @@ static struct arch_domain *get_arch_domain(struct arch_domain *doms, const char
 {
        struct arch_domain *d;
 
-       for (d = doms; d->perval >= 0; d++) {
+       for (d = doms; d && d->perval >= 0; d++) {
                if (!strcmp(pers, d->target_arch))
                        break;
        }