]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: check ul_path_readf_s32() return value [coverity: CID 504058]
authorKarel Zak <kzak@redhat.com>
Mon, 13 Jul 2026 10:29:57 +0000 (12:29 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 13 Jul 2026 10:29:57 +0000 (12:29 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-topology.c

index eaba86a04663bdcb6eaf32e10876eaf858bb9c37..620dfff557dbbec652370dc0fc1cb7c4f7012ccd 100644 (file)
@@ -584,8 +584,8 @@ static int read_address(struct lscpu_cxt *cxt, struct lscpu_cpu *cpu)
 
        DBG_OBJ(CPU, cpu, ul_debug("#%d reading address", num));
 
-       ul_path_readf_s32(sys, &cpu->address, "cpu%d/address", num);
-       if (cpu->type)
+       if (ul_path_readf_s32(sys, &cpu->address, "cpu%d/address", num) == 0
+           && cpu->type)
                cpu->type->has_addresses = 1;
        return 0;
 }