ps3: R.I.P.
[openwrt.git] / target / linux / goldfish / patches-2.6.30 / 0110-printk-Fix-log_buf_copy-termination.patch
1 From e500cd364086cfc018b100d08c97b2fdf229d029 Mon Sep 17 00:00:00 2001
2 From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>
3 Date: Mon, 14 Apr 2008 21:35:25 -0700
4 Subject: [PATCH 110/134] printk: Fix log_buf_copy termination.
5
6 If idx was non-zero and the log had wrapped, len did not get truncated
7 to stop at the last byte written to the log.
8 ---
9  kernel/printk.c |    4 ++--
10  1 files changed, 2 insertions(+), 2 deletions(-)
11
12 --- a/kernel/printk.c
13 +++ b/kernel/printk.c
14 @@ -279,8 +279,8 @@ int log_buf_copy(char *dest, int idx, in
15         if (idx < 0 || idx >= max) {
16                 ret = -1;
17         } else {
18 -               if (len > max)
19 -                       len = max;
20 +               if (len > max - idx)
21 +                       len = max - idx;
22                 ret = len;
23                 idx += (log_end - max);
24                 while (len-- > 0)