From c941545c7eea09587bec50929b9d6b3d4d5cb045 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 17 Mar 2022 12:22:01 +0100 Subject: [PATCH] lib/path: initialize variables for scanf [coverity scan] Signed-off-by: Karel Zak --- lib/path.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/path.c b/lib/path.c index 20a3ea15d2..42b4eadf16 100644 --- a/lib/path.c +++ b/lib/path.c @@ -815,7 +815,7 @@ int ul_path_readf_s32(struct path_cxt *pc, int *res, const char *path, ...) int ul_path_read_u32(struct path_cxt *pc, unsigned int *res, const char *path) { int rc; - unsigned int x; + unsigned int x = 0; rc = ul_path_scanf(pc, path, "%u", &x); if (rc != 1) @@ -839,7 +839,7 @@ int ul_path_readf_u32(struct path_cxt *pc, unsigned int *res, const char *path, int ul_path_read_majmin(struct path_cxt *pc, dev_t *res, const char *path) { - int rc, maj, min; + int rc, maj = 0, min = 0; rc = ul_path_scanf(pc, path, "%d:%d", &maj, &min); if (rc != 2) -- 2.47.2