lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 19 Mar 2018 23:57:13 +0800
From:   Kai Heng Feng <kai.heng.feng@...onical.com>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Greg KH <gregkh@...uxfoundation.org>, fengguang.wu@...el.com,
        oneukum@...e.com, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6] usb: core: Add "quirks" parameter for usbcore

Kai Heng Feng <kai.heng.feng@...onical.com> wrote:

> Matthew Wilcox <willy@...radead.org> wrote:
>
>> On Tue, Mar 13, 2018 at 03:26:19PM +0800, Kai-Heng Feng wrote:
>>> +	usbcore.quirks=
>>> +			[USB] A list of quirks entries to supplement or
>>> +			override the built-in usb core quirk list.  List
>>> +			entries are separated by commas.  Each entry has
>>> +			the form VID:PID:Flags where VID and PID are Vendor
>>> +			and Product ID values (4-digit hex numbers) and
>>> +			Flags is a set of characters, each corresponding
>>> +			to a common usb core quirk flag as follows:
>>
>> This doesn't really tell me that the specified quirks will be XORed with
>> the built-in quirks.  Maybe something like ...
>>
>> 			[USB] A list of quirk entries to augment the
>> 			built-in usb core quirk list.  List entries are
>> 			separated by commas.  Each entry has the form
>> 			VendorID:ProductID:Flags.  The IDs are 4-digit hex
>> 			numbers and Flags is a set of letters.  Each letter
>> 			will change the built-in quirk; setting it if it is
>> 			clear and clearing it if it is set.  The letters
>> 			have the following meanings:
>
> Thanks, will update the description to specify the XOR behavior.
>
>>> +		/* Each entry consists of VID:PID:flags */
>>> +		field = strsep(&p, ":");
>>> +		if (!field)
>>> +			break;
>>> +
>>> +		if (kstrtou16(field, 16, &vid))
>>> +			break;
>>> +
>>> +		field = strsep(&p, ":");
>>> +		if (!field)
>>> +			break;
>>> +
>>> +		if (kstrtou16(field, 16, &pid))
>>> +			break;
>>
>> Is there a reason to not use sscanf here like hid-quirks.c does?
>
> Actually I use sscanf in previous patch version. Using kstrto* isn't  
> needed anymore, I'll use sscanf in next version.

Okay, I remember why I don't use sscanf, mainly because the quirk_param in  
hid-quirks.c is charp instead of char, so using sscanf is trivia for it.

We use plain char* here because of module_param_cb(), so I guess using  
sscanf doesn't make much sense here. strsep() isn't the most elegant  
solution but it does its job well.

I'll update the description and send a new patch.

Kai-Heng

>
> Kai-Heng


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ