From mboxrd@z Thu Jan 1 00:00:00 1970 From: joeyli Subject: Re: [PATCH] efivarfs: fix abnormal GUID in variable name by using strcpy to replace null with dash Date: Thu, 07 Mar 2013 16:03:47 +0800 Message-ID: <1362643427.28562.16.camel@linux-s257.site> References: <1362108018-13117-1-git-send-email-jlee@suse.com> <1362151068.2842.440.camel@mfleming-mobl1.ger.corp.intel.com> <1362155493.2842.446.camel@mfleming-mobl1.ger.corp.intel.com> <1362181299.23932.168.camel@linux-s257.site> <1362555258.23932.573.camel@linux-s257.site> <51370A51.1050505@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <51370A51.1050505-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Lingzhu Xiang Cc: Matt Fleming , linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michael Schroeder , Josh Boyer , Peter Jones , Matthew Garrett , Frederic Crozat List-Id: linux-efi@vger.kernel.org =E6=96=BC =E4=B8=89=EF=BC=8C2013-03-06 =E6=96=BC 17:20 +0800=EF=BC=8CLi= ngzhu Xiang =E6=8F=90=E5=88=B0=EF=BC=9A > On 03/06/2013 03:34 PM, joeyli wrote: > > +static unsigned long variable_name_length(efi_char16_t *variable_n= ame) > > +{ > > + unsigned long len; > > + efi_char16_t c; > > + > > + len =3D 2; > > + do { > > + c =3D variable_name[len / sizeof(c) - 1]; > > + if (c) > > + len +=3D sizeof(c); > > + } while (c); > > + > > + return len; > > +} > > + >=20 > It looks like this function can be replaced with utf16_strsize. >=20 Ah! thanks for you point out, I will use utf16_strsize. Thanks a lot! Joey Lee From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754690Ab3CGIFR (ORCPT ); Thu, 7 Mar 2013 03:05:17 -0500 Received: from smtp.nue.novell.com ([195.135.221.5]:35269 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754455Ab3CGIFP (ORCPT ); Thu, 7 Mar 2013 03:05:15 -0500 Subject: Re: [PATCH] efivarfs: fix abnormal GUID in variable name by using strcpy to replace null with dash From: joeyli To: Lingzhu Xiang Cc: Matt Fleming , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Schroeder , Josh Boyer , Peter Jones , Matthew Garrett , Frederic Crozat In-Reply-To: <51370A51.1050505@redhat.com> References: <1362108018-13117-1-git-send-email-jlee@suse.com> <1362151068.2842.440.camel@mfleming-mobl1.ger.corp.intel.com> <1362155493.2842.446.camel@mfleming-mobl1.ger.corp.intel.com> <1362181299.23932.168.camel@linux-s257.site> <1362555258.23932.573.camel@linux-s257.site> <51370A51.1050505@redhat.com> Content-Type: text/plain; charset="UTF-8" Date: Thu, 07 Mar 2013 16:03:47 +0800 Message-ID: <1362643427.28562.16.camel@linux-s257.site> Mime-Version: 1.0 X-Mailer: Evolution 2.28.2 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 於 三,2013-03-06 於 17:20 +0800,Lingzhu Xiang 提到: > On 03/06/2013 03:34 PM, joeyli wrote: > > +static unsigned long variable_name_length(efi_char16_t *variable_name) > > +{ > > + unsigned long len; > > + efi_char16_t c; > > + > > + len = 2; > > + do { > > + c = variable_name[len / sizeof(c) - 1]; > > + if (c) > > + len += sizeof(c); > > + } while (c); > > + > > + return len; > > +} > > + > > It looks like this function can be replaced with utf16_strsize. > Ah! thanks for you point out, I will use utf16_strsize. Thanks a lot! Joey Lee