提交 813416ba 编写于 作者: D Deepa Dinamani 提交者: Xie XiuQi

pstore: fs superblock limits

[ 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: 3f8f80f0 ("pstore/ram: Read and write to the 'compressed' flag of pstore").
Signed-off-by: NDeepa Dinamani <deepa.kernel@gmail.com>
Acked-by: NKees Cook <keescook@chromium.org>
Acked-by: NJeff Layton <jlayton@kernel.org>
Cc: anton@enomsg.org
Cc: ccross@android.com
Cc: keescook@chromium.org
Cc: tony.luck@intel.com
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 589f74b6
...@@ -162,6 +162,7 @@ static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time, ...@@ -162,6 +162,7 @@ static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time,
if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu-%c\n%n", if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu-%c\n%n",
(time64_t *)&time->tv_sec, &time->tv_nsec, &data_type, (time64_t *)&time->tv_sec, &time->tv_nsec, &data_type,
&header_length) == 3) { &header_length) == 3) {
time->tv_nsec *= 1000;
if (data_type == 'C') if (data_type == 'C')
*compressed = true; *compressed = true;
else else
...@@ -169,6 +170,7 @@ static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time, ...@@ -169,6 +170,7 @@ static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time,
} else if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu\n%n", } else if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu\n%n",
(time64_t *)&time->tv_sec, &time->tv_nsec, (time64_t *)&time->tv_sec, &time->tv_nsec,
&header_length) == 2) { &header_length) == 2) {
time->tv_nsec *= 1000;
*compressed = false; *compressed = false;
} else { } else {
time->tv_sec = 0; time->tv_sec = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册