Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753101Ab3IWAZW (ORCPT ); Sun, 22 Sep 2013 20:25:22 -0400 Received: from terminus.zytor.com ([198.137.202.10]:37671 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752773Ab3IWAZU (ORCPT ); Sun, 22 Sep 2013 20:25:20 -0400 Message-ID: <523F8A3C.7010209@zytor.com> Date: Sun, 22 Sep 2013 17:24:28 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: Roy Franz CC: Linux Kernel Mailing List , linux-efi@vger.kernel.org, matt.fleming@intel.com, Leif Lindholm , Grant Likely , Mark Salter Subject: Re: [PATCH 10/18] Do proper conversion from UTF-16 to UTF-8 References: <1379889942-3135-1-git-send-email-roy.franz@linaro.org> <1379889942-3135-11-git-send-email-roy.franz@linaro.org> In-Reply-To: X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1852 Lines: 49 On 09/22/2013 04:07 PM, Roy Franz wrote: > On Sun, Sep 22, 2013 at 3:54 PM, H. Peter Anvin 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/