diff options
Diffstat (limited to 'drivers/char/ramoops.c')
-rw-r--r-- | drivers/char/ramoops.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c index 74f00b5ffa36..9445f48c692f 100644 --- a/drivers/char/ramoops.c +++ b/drivers/char/ramoops.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/ioport.h> | 27 | #include <linux/ioport.h> |
28 | 28 | ||
29 | #define RAMOOPS_KERNMSG_HDR "====" | 29 | #define RAMOOPS_KERNMSG_HDR "====" |
30 | #define RAMOOPS_HEADER_SIZE (5 + sizeof(struct timeval)) | ||
31 | 30 | ||
32 | #define RECORD_SIZE 4096 | 31 | #define RECORD_SIZE 4096 |
33 | 32 | ||
@@ -63,8 +62,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
63 | struct ramoops_context, dump); | 62 | struct ramoops_context, dump); |
64 | unsigned long s1_start, s2_start; | 63 | unsigned long s1_start, s2_start; |
65 | unsigned long l1_cpy, l2_cpy; | 64 | unsigned long l1_cpy, l2_cpy; |
66 | int res; | 65 | int res, hdr_size; |
67 | char *buf; | 66 | char *buf, *buf_orig; |
68 | struct timeval timestamp; | 67 | struct timeval timestamp; |
69 | 68 | ||
70 | /* Only dump oopses if dump_oops is set */ | 69 | /* Only dump oopses if dump_oops is set */ |
@@ -72,6 +71,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
72 | return; | 71 | return; |
73 | 72 | ||
74 | buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); | 73 | buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); |
74 | buf_orig = buf; | ||
75 | |||
75 | memset(buf, '\0', RECORD_SIZE); | 76 | memset(buf, '\0', RECORD_SIZE); |
76 | res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); | 77 | res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); |
77 | buf += res; | 78 | buf += res; |
@@ -79,8 +80,9 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
79 | res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); | 80 | res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); |
80 | buf += res; | 81 | buf += res; |
81 | 82 | ||
82 | l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE)); | 83 | hdr_size = buf - buf_orig; |
83 | l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE) - l2_cpy); | 84 | l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - hdr_size)); |
85 | l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - hdr_size) - l2_cpy); | ||
84 | 86 | ||
85 | s2_start = l2 - l2_cpy; | 87 | s2_start = l2 - l2_cpy; |
86 | s1_start = l1 - l1_cpy; | 88 | s1_start = l1 - l1_cpy; |