From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751188AbdFBI0b (ORCPT ); Fri, 2 Jun 2017 04:26:31 -0400 Received: from mga14.intel.com ([192.55.52.115]:36890 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751153AbdFBI03 (ORCPT ); Fri, 2 Jun 2017 04:26:29 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,284,1493708400"; d="asc'?scan'208";a="1177383989" From: Felipe Balbi To: Stefan Agner Cc: Krzysztof Opasiak , gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] fs: configfs: make qw_sign attribute symmetric In-Reply-To: <0a65de386fcfa0841dc88a238b38ec0c@agner.ch> References: <20170415013509.20844-1-stefan@agner.ch> <0a65de386fcfa0841dc88a238b38ec0c@agner.ch> Date: Fri, 02 Jun 2017 11:25:50 +0300 Message-ID: <87o9u6vlrl.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Stefan Agner writes: > Hi Felipe, > > On 2017-04-19 01:53, Krzysztof Opasiak wrote: >> On 04/15/2017 03:35 AM, Stefan Agner wrote: >>> Currently qw_sign requires UTF-8 character to set, but returns UTF-16 >>> when read. This isn't obvious when simply using cat since the null >>> characters are not visible, but hexdump unveils the true string: >>> >>> # echo MSFT100 > os_desc/qw_sign >>> # hexdump -C os_desc/qw_sign >>> 00000000 4d 00 53 00 46 00 54 00 31 00 30 00 30 00 |M.S.F.T.= 1.0.0.| >>> >>> Make qw_sign symmetric by returning an UTF-8 string too. Also follow >>> common convention and add a new line at the end. >>> >>> Signed-off-by: Stefan Agner >>> --- >>> Resend as discussed here: >>> https://patchwork.kernel.org/patch/9548869/ >>> >>> Sorry, a bit later than we discussed... Hope still not too late? >>> >>> -- >>> Stefan >>> >>> drivers/usb/gadget/configfs.c | 8 ++++++-- >>> 1 file changed, 6 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configf= s.c >>> index cbff3b02840d..863ca4ded1be 100644 >>> --- a/drivers/usb/gadget/configfs.c >>> +++ b/drivers/usb/gadget/configfs.c >>> @@ -787,9 +787,13 @@ static ssize_t os_desc_b_vendor_code_store(struct = config_item *item, >>> static ssize_t os_desc_qw_sign_show(struct config_item *item, char *pa= ge) >>> { >>> struct gadget_info *gi =3D os_desc_item_to_gadget_info(item); >>> + int res; >>> >>> - memcpy(page, gi->qw_sign, OS_STRING_QW_SIGN_LEN); >>> - return OS_STRING_QW_SIGN_LEN; >>> + res =3D utf16s_to_utf8s((wchar_t *) gi->qw_sign, OS_STRING_QW_SIGN_LE= N, >>> + UTF16_LITTLE_ENDIAN, page, PAGE_SIZE - 1); >>> + page[res++] =3D '\n'; >>> + >>> + return res; >>> } >>> >>> static ssize_t os_desc_qw_sign_store(struct config_item *item, const c= har *page, >>> >>=20 >> Code itself looks good to me and from libusbgx perspective it's also >> fine to add this new line as we can just drop it like we do with other >> newlines in case of gadget/config strings. >>=20 >> Reviewed-by: Krzysztof Opasiak >>=20 > > Any chance we get this in this merge window? > > This still applies fine on v4.12-rc2. I wouldn't consider this a fix. I'll get this into v4.13 merge window. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlkxIQ4ACgkQzL64meEa mQaTXRAAuIEDg4l8Mf2/XQR39RkKLnj3+5FRJbOpeILG7+znNyWZDBTy+LrN0KKP NibCkfsPb2aG9Wr7rAINKjRd5No0BXtHA3W8GetKfVa6jAUXWGcjab2zojF2ZT76 7BIXuZT0C6XaPjxXgAW/uOd+Z5lqJGRGS5tAuyetMConjvU2lMjps4O/FGVQOvI5 V8Qx/ox/YLr8d69rjUs44BMxjRFlIfiw1RRLht4wGc+QALjXxJUfERxI9yhKiU+E e05Im2PgTATNqAN/RtjCLaGeMDwbNb8XQfQV+iptmxx5UOxc+WCL/WpqKz52xOHs abTTqRvFq+K94i1hEIVVfzD9jdR/WwsrBwB9EblgBza7LsdMc0tc0q0U5q2CNyiw Uxnn5dAyb34vUTGxs0ZDQqCvaTTE76RYLnRhtMlmzP+dC++hfuEfEDr2Co9qi7V0 34Gm4FthODFAgWoN85CbmCJj2OotpuONLDLTsG60dqdP9sm7v8zfaVmtHqmv4AZH AxdU0jDyKRi1wBIp5WoVPujoJXubaCNQBpeESDkXcovFQI5LYtQ+GqTae+Zm61VZ tNlV6/tVO5uX61UjHcDJd0MmhYsBvK5D5j1NTFBmVLejuYPzHE8SsntY9DZOpLU0 0Dnu6XReZFO4UZ9T32zC6Uc97hpODumXFI0/7rAtW/RB1nihJBk= =R9tD -----END PGP SIGNATURE----- --=-=-=--