[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+55aFyg7z5Fn04aY6Kczru5ZnwXeHNV8EZU=J4p4wGxZVChJw@mail.gmail.com>
Date: Thu, 10 May 2012 09:05:09 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Kay Sievers <kay@...y.org>, Greg Kroah-Hartmann <greg@...ah.com>,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH RESEND 2/3] kmsg: export printk records to the /dev/kmsg interface
On Thu, May 10, 2012 at 4:45 AM, Dan Carpenter <dan.carpenter@...cle.com> wrote:
> On Thu, May 03, 2012 at 02:29:41AM +0200, Kay Sievers wrote:
>> + /* escape non-printable characters */
>> + for (i = 0; i < msg->text_len; i++) {
>> + char c = log_text(msg)[i];
>> +
>> + if (c < ' ' || c >= 128)
>
> Signed char type is never larger than 127.
You don't know that it's signed.
The sign of "char" is implementation-defined, and there are indeed
architectures that Linux supports where it is unsigned (I think ARM is
one example).
So that comparison against 128 is actually required.
Or, better yet, the code should make 'c' *explicitly* signed (or
unsigned) so that this particular C language definition oddity is
avoided entirely.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists