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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 19 Dec 2013 11:38:34 -0500 (EST)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
cc:	Rashika Kheria <rashika.kheria@...il.com>,
	<linux-kernel@...r.kernel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	<linux-usb@...r.kernel.org>, <josh@...htriplett.org>
Subject: Re: [PATCH 3/7] drivers: usb: Include appropriate header file in
 hcd.h

On Thu, 19 Dec 2013, Sergei Shtylyov wrote:

> Hello.
> 
> On 12/19/2013 06:45 PM, Alan Stern wrote:
> 
> >> Include header file include/linux/usb.h in include/linux/usb/hcd.h
> >> because structures usb_device, usb_host_config and usb_interface have
> >> their definitions in include/linux/usb.h.
> 
> >> This eliminates the following warning in include/linux/usb/hcd.h:
> >> include/linux/usb/hcd.h:311:44: warning: ‘struct usb_device’ declared inside parameter list [enabled by default]
> >> include/linux/usb/hcd.h:412:10: warning: ‘struct usb_host_config’ declared inside parameter list [enabled by default]
> >> include/linux/usb/hcd.h:614:9: warning: ‘struct usb_interface’ declared inside parameter list [enabled by default]
> 
>     Rashika, would it be enough to forward-declare these structures ISO 
> #include'ing the whole header?

I agree, that would fix the problem.

> > Where does this problem show up?
> >
> > Any file that include linux/usb/hcd.h should include linux/usb.h first.
> > IMO it would be better to fix the source files that don't do the
> > includes properly.
> 
>     Yeah, let's fix the consequency instead of the cause. :-)

The _real_ cause is that the Linux source code is extremely
complicated, and it is remarkably difficult to insure that all header
files have no unsatisfied dependencies.  How do you suggest fixing
_that_?

For example, suppose A.c includes B.h, and B.h includes C.h, and C.h
defines struct foo.  Then A.c can use struct foo freely without
including C.h directly (and this sort of thing happens quite a lot in
the kernel source).  But consider what happens when B.h is changed so
that it no longer includes C.h.

> > Of course, people have varying opinions on this issue.  As far as I
> > know, there is no fixed policy in the kernel about nested includes.
> 
>     So far, I've only encountered the dubious policy of satisfying header's 
> dependencies in the files that include them is the USB tree.

Have you looked in any other places?  For that matter, how do you know
that the USB tree has such a policy?  Is it documented anywhere?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ