[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <523F8A3C.7010209@zytor.com>
Date: Sun, 22 Sep 2013 17:24:28 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Roy Franz <roy.franz@...aro.org>
CC: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-efi@...r.kernel.org, matt.fleming@...el.com,
Leif Lindholm <leif.lindholm@...aro.org>,
Grant Likely <grant.likely@...aro.org>,
Mark Salter <msalter@...hat.com>
Subject: Re: [PATCH 10/18] Do proper conversion from UTF-16 to UTF-8
On 09/22/2013 04:07 PM, Roy Franz wrote:
> On Sun, Sep 22, 2013 at 3:54 PM, H. Peter Anvin <hpa@...or.com> wrote:
>> Sorry this version is broken and doesn't even compile due to remaining options_size references.
>
> I compiled and tested this series on both x86_64 (using OVMF) and on
> the ARM simulator. I just doubled checked
> my kernel .config to verify this was not being omitted and I'm pretty
> sure this doesn't have any compilation problems.
> I did make a few changes to get the untested version you sent out to
> compile, but they all seemed to be straightforward typo type fixes.
> I'll gladly address any defects in this patch, but I don't see an
> compilation problems.
>
Ah yes, I see now... you fixed up the compile problem but did so
incorrectly.
int load_options_size = image->load_options_size / 2; /* ASCII */
This is a number of UTF-16 chars, the comment is completely wrong;
- while (*s2 && *s2 != '\n' && options_size <
load_options_size) {
+ while (*s2 && *s2 != '\n' && options_bytes <
load_options_size) {
+ options_bytes += efi_utf8_bytes(*s2);
s2++;
- options_size++;
}
+ options_chars = s2 - options;
You can't compare options_bytes against load_options_size; the latter
being a UTF-16 shortword count.
So the loop really needs to update options_chars in the loop to compare
it against load_options_size:
while (*s2 && *s2 != '\n' && options_chars < load_options_size) {
options_bytes += efi_utf8_bytes(*s2++);
option_chars++;
}
-hpa
--
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