From 3aefa216bf5e8bcfaf5a628e9e06672e786ce9ea Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Fri, 28 Apr 2023 11:09:22 +0200
Subject: [PATCH] pstore: explicitly set the base when converting record ID

(cherry picked from commit a95d96a2430db171b40fc2e50589807236f8f746)

Related: #2190151
---
 src/pstore/pstore.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pstore/pstore.c b/src/pstore/pstore.c
index 5335c9f92d..073fedb7d2 100644
--- a/src/pstore/pstore.c
+++ b/src/pstore/pstore.c
@@ -207,7 +207,7 @@ static int append_dmesg(PStoreEntry *pe, const char *subdir1, const char *subdir
 static int process_dmesg_files(PStoreList *list) {
         /* Move files, reconstruct dmesg.txt */
         _cleanup_free_ char *erst_subdir = NULL;
-        uint64_t last_record_id = 0;
+        unsigned long long last_record_id = 0;
 
         /* When dmesg is written into pstore, it is done so in small chunks, whatever the exchange buffer
          * size is with the underlying pstore backend (ie. EFI may be ~2KiB), which means an example
@@ -263,9 +263,9 @@ static int process_dmesg_files(PStoreList *list) {
                 } else if ((p = startswith(pe->dirent.d_name, "dmesg-erst-"))) {
                         /* For the ERST backend, the record is a monotonically increasing number, seeded as
                          * a timestamp. See linux/drivers/acpi/apei/erst.c in erst_writer(). */
-                        uint64_t record_id;
+                        unsigned long long record_id;
 
-                        if (safe_atou64(p, &record_id) < 0)
+                        if (safe_atollu_full(p, 10, &record_id) < 0)
                                 continue;
                         if (last_record_id - 1 != record_id)
                                 /* A discontinuity in the number has been detected, this current record id
