From: Karel Zak Date: Mon, 13 Jul 2026 10:32:59 +0000 (+0200) Subject: chcpu: check ul_path_readf_s32() return value [coverity: CID 504056] X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d1170ef7e1558412f1c5c5d9b1fbf8581592f02;p=thirdparty%2Futil-linux.git chcpu: check ul_path_readf_s32() return value [coverity: CID 504056] Signed-off-by: Karel Zak --- diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c index 43d1f457e..a1d8b347d 100644 --- a/sys-utils/chcpu.c +++ b/sys-utils/chcpu.c @@ -103,8 +103,9 @@ static int cpu_enable(struct chcpu_context *ctx, int enable) continue; } - if (ul_path_accessf(ctx->sys, F_OK, "cpu%d/configure", cpu) == 0) - ul_path_readf_s32(ctx->sys, &configured, "cpu%d/configure", cpu); + if (ul_path_accessf(ctx->sys, F_OK, "cpu%d/configure", cpu) != 0 + || ul_path_readf_s32(ctx->sys, &configured, "cpu%d/configure", cpu) != 0) + configured = -1; if (enable) { rc = ul_path_writef_string(ctx->sys, "1", "cpu%d/online", cpu); if (rc != 0 && configured == 0) {