]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pstore: fs superblock limits
authorDeepa Dinamani <deepa.kernel@gmail.com>
Sun, 23 Jun 2019 23:00:01 +0000 (16:00 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Oct 2019 16:59:17 +0000 (18:59 +0200)
[ Upstream commit 83b8a3fbe3aa82ac3c253b698ae6a9be2dbdd5e0 ]

Leaving granularity at 1ns because it is dependent on the specific
attached backing pstore module. ramoops has microsecond resolution.

Fix the readback of ramoops fractional timestamp microseconds,
which has incorrectly been reporting the value as nanoseconds.

Fixes: 3f8f80f0cfeb ("pstore/ram: Read and write to the 'compressed' flag of pstore").
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Jeff Layton <jlayton@kernel.org>
Cc: anton@enomsg.org
Cc: ccross@android.com
Cc: keescook@chromium.org
Cc: tony.luck@intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/pstore/ram.c

index 5b77098944151cb6f37e4516f6c5c02e28fc274f..db9f67d34af37b5aac20bf3c8a2e9a134e875fc4 100644 (file)
@@ -144,6 +144,7 @@ static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time,
        if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu-%c\n%n",
                   (time64_t *)&time->tv_sec, &time->tv_nsec, &data_type,
                   &header_length) == 3) {
+               time->tv_nsec *= 1000;
                if (data_type == 'C')
                        *compressed = true;
                else
@@ -151,6 +152,7 @@ static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time,
        } else if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu\n%n",
                          (time64_t *)&time->tv_sec, &time->tv_nsec,
                          &header_length) == 2) {
+               time->tv_nsec *= 1000;
                *compressed = false;
        } else {
                time->tv_sec = 0;