diff options
author | Dave Airlie <airlied@redhat.com> | 2011-01-05 08:31:08 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-01-05 08:31:08 +1000 |
commit | 4f125010d2d02c481a0fdf5aee23a9f937bc5de1 (patch) | |
tree | dcdcd2ba1d0bb980b57ced9a1b2b5b17c84c8f57 /drivers/char | |
parent | 204663c48711ddceee09df46269cd34d49d1f7be (diff) | |
parent | 989d873fc5b6a96695b97738dea8d9f02a60f8ab (diff) | |
download | linux-4f125010d2d02c481a0fdf5aee23a9f937bc5de1.tar.bz2 |
Merge branch 'master' of /home/airlied/kernel/linux-2.6 into drm-core-next
Diffstat (limited to 'drivers/char')
-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 @@ #include <linux/ramoops.h> #define RAMOOPS_KERNMSG_HDR "====" -#define RAMOOPS_HEADER_SIZE (5 + sizeof(struct timeval)) #define RECORD_SIZE 4096 @@ -65,8 +64,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, struct ramoops_context, dump); unsigned long s1_start, s2_start; unsigned long l1_cpy, l2_cpy; - int res; - char *buf; + int res, hdr_size; + char *buf, *buf_orig; struct timeval timestamp; /* Only dump oopses if dump_oops is set */ @@ -74,6 +73,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, return; buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); + buf_orig = buf; + memset(buf, '\0', RECORD_SIZE); res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); buf += res; @@ -81,8 +82,9 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); buf += res; - l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE)); - l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE) - l2_cpy); + hdr_size = buf - buf_orig; + l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - hdr_size)); + l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - hdr_size) - l2_cpy); s2_start = l2 - l2_cpy; s1_start = l1 - l1_cpy; |