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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <58b124ba-47f2-78d6-8183-51d61356250a@roeck-us.net>
Date:   Mon, 5 Apr 2021 12:25:25 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Alan Stern <stern@...land.harvard.edu>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 5/6] usb: Iterator for ports

On 3/31/21 11:37 PM, Heikki Krogerus wrote:
> On Wed, Mar 31, 2021 at 09:41:22AM -0700, Guenter Roeck wrote:
>>> diff --git a/include/linux/usb.h b/include/linux/usb.h
>>> index ddd2f5b2a2827..ebcd03d835d04 100644
>>> --- a/include/linux/usb.h
>>> +++ b/include/linux/usb.h
>>> @@ -882,6 +882,15 @@ extern struct usb_host_interface *usb_find_alt_setting(
>>>  		unsigned int iface_num,
>>>  		unsigned int alt_num);
>>>  
>>> +#ifdef CONFIG_USB
>>
>> #if IS_ENABLED(CONFIG_USB)
> 
Note that IS_REACHABLE(), as you ended up using, has a slightly different
semantics.

With IS_ENABLED(), one still has to ensure, via config file dependencies,
that the code using the API is reachable. That would be something like
	depends on USB || USB=n
This dependency ensures that the code using the API code is not built
into the kernel if USB is built as module. In most cases this reflects
the intended use case.

IS_REACHABLE(), on the other side, will disable the API if USB is built
as module and the calling code is built into the kernel. This can have
unexpected results and should be used with caution.

Thanks,
Guenter

> Thanks Guenter.
> 
>>> +int usb_for_each_port(void *data, int (*fn)(struct device *, void *));
>>> +#else
>>> +static inline int usb_for_each_port(void *data, int (*fn)(struct device *, void *))
>>> +{
>>> +	return 0;
>>> +}
>>> +#endif
>>> +
>>>  /* port claiming functions */
>>>  int usb_hub_claim_port(struct usb_device *hdev, unsigned port1,
>>>  		struct usb_dev_state *owner);
>>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ