diff options
| -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 73dcb0ee41fd..d3d63be2cd37 100644 --- a/drivers/char/ramoops.c +++ b/drivers/char/ramoops.c | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | #include <linux/ramoops.h> | 29 | #include <linux/ramoops.h> |
| 30 | 30 | ||
| 31 | #define RAMOOPS_KERNMSG_HDR "====" | 31 | #define RAMOOPS_KERNMSG_HDR "====" |
| 32 | #define RAMOOPS_HEADER_SIZE (5 + sizeof(struct timeval)) | ||
| 33 | 32 | ||
| 34 | #define RECORD_SIZE 4096 | 33 | #define RECORD_SIZE 4096 |
| 35 | 34 | ||
| @@ -65,8 +64,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
| 65 | struct ramoops_context, dump); | 64 | struct ramoops_context, dump); |
| 66 | unsigned long s1_start, s2_start; | 65 | unsigned long s1_start, s2_start; |
| 67 | unsigned long l1_cpy, l2_cpy; | 66 | unsigned long l1_cpy, l2_cpy; |
| 68 | int res; | 67 | int res, hdr_size; |
| 69 | char *buf; | 68 | char *buf, *buf_orig; |
| 70 | struct timeval timestamp; | 69 | struct timeval timestamp; |
| 71 | 70 | ||
| 72 | /* Only dump oopses if dump_oops is set */ | 71 | /* Only dump oopses if dump_oops is set */ |
| @@ -74,6 +73,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
| 74 | return; | 73 | return; |
| 75 | 74 | ||
| 76 | buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); | 75 | buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); |
| 76 | buf_orig = buf; | ||
| 77 | |||
| 77 | memset(buf, '\0', RECORD_SIZE); | 78 | memset(buf, '\0', RECORD_SIZE); |
| 78 | res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); | 79 | res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); |
| 79 | buf += res; | 80 | buf += res; |
| @@ -81,8 +82,9 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
| 81 | res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); | 82 | res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); |
| 82 | buf += res; | 83 | buf += res; |
| 83 | 84 | ||
| 84 | l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE)); | 85 | hdr_size = buf - buf_orig; |
| 85 | l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE) - l2_cpy); | 86 | l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - hdr_size)); |
| 87 | l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - hdr_size) - l2_cpy); | ||
| 86 | 88 | ||
| 87 | s2_start = l2 - l2_cpy; | 89 | s2_start = l2 - l2_cpy; |
| 88 | s1_start = l1 - l1_cpy; | 90 | s1_start = l1 - l1_cpy; |
