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]
Message-ID: <20220726090801.1d4a6137@kernel.org>
Date:   Tue, 26 Jul 2022 09:08:01 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Paolo Abeni <pabeni@...hat.com>
Cc:     davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com
Subject: Re: [PATCH net-next] add missing includes and forward declarations
 to networking includes under linux/

On Tue, 26 Jul 2022 12:00:47 +0200 Paolo Abeni wrote:
> On Fri, 2022-07-22 at 21:57 -0700, Jakub Kicinski wrote:
> > Similarly to a recent include/net/ cleanup, this patch adds
> > missing includes to networking headers under include/linux.
> > All these problems are currently masked by the existing users
> > including the missing dependency before the broken header.

Thanks for the detailed review!

> > --- a/include/linux/if_tap.h
> > +++ b/include/linux/if_tap.h
> > @@ -2,6 +2,8 @@
> >  #ifndef _LINUX_IF_TAP_H_
> >  #define _LINUX_IF_TAP_H_
> >  
> > +struct file;  
> 
> I guess even:
> 
> struct socket;
> struct ptr_ring;
> 
> are needed, and you can remove the forward declaration from the #else
> branch.

Let me move the includes which are later on int the file, for some
reason, up.

> >  #if IS_ENABLED(CONFIG_TAP)
> >  struct socket *tap_get_socket(struct file *);
> >  struct ptr_ring *tap_get_ptr_ring(struct file *file);
> > diff --git a/include/linux/mdio/mdio-xgene.h b/include/linux/mdio/mdio-xgene.h
> > index 8af93ada8b64..9e588965dc83 100644
> > --- a/include/linux/mdio/mdio-xgene.h
> > +++ b/include/linux/mdio/mdio-xgene.h
> > @@ -8,6 +8,10 @@
> >  #ifndef __MDIO_XGENE_H__
> >  #define __MDIO_XGENE_H__
> >  
> > +#include <linux/bits.h>
> > +#include <linux/spinlock.h>
> > +#include <linux/types.h>
> > +  
> 
> possibly even:
> 
> struct clk;
> struct device;
> struct mii_bus;
> 
> used below.

I don't understand why but apparently using a struct type in another
struct is considered a forward declaration.

09:05 ~$ cat /tmp/one.c 
int some_func(struct bla *b);

int main()
{
	return 0;
}
09:05 ~$ gcc -W -Wall -Wextra -O2 /tmp/one.c  -o /dev/null
/tmp/one.c:1:22: warning: ‘struct bla’ declared inside parameter list will not be visible outside of this definition or declaration
    1 | int some_func(struct bla *b);
      |                      ^~~
09:05 ~$ cat /tmp/two.c 
struct other {
	struct bla *b;
};

int some_func(struct bla *b);

int main()
{
	return 0;
}
09:05 ~$ gcc -W -Wall -Wextra -O2 /tmp/two.c  -o /dev/null
09:05 ~$ 

> > +++ b/include/linux/sungem_phy.h
> > @@ -2,6 +2,8 @@
> >  #ifndef __SUNGEM_PHY_H__
> >  #define __SUNGEM_PHY_H__
> >  
> > +#include <linux/types.h>
> > +
> >  struct mii_phy;  
> 
> Possibly even:
> 
> struct net_device;

Same story.

> >  /* Operations supported by any kind of PHY */
> > diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
> > index 1b4d72d5e891..b42b72391a8d 100644
> > --- a/include/linux/usb/usbnet.h
> > +++ b/include/linux/usb/usbnet.h
> > @@ -23,6 +23,12 @@
> >  #ifndef	__LINUX_USB_USBNET_H
> >  #define	__LINUX_USB_USBNET_H
> >  
> > +#include <linux/mii.h>
> > +#include <linux/netdevice.h>
> > +#include <linux/skbuff.h>
> > +#include <linux/types.h>  
> 
> 'linux/types.h' should not be needed: already included via skbuff.h ->
> atomic.h -> types.h

Yea... sometimes I added it sometimes I didn't.. :)  I don't think 
the explicit include hurts.

> > +#include <linux/usb.h>
> > +
> >  /* interface from usbnet core to each USB networking link we handle */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ