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:   Tue, 3 Oct 2017 15:36:11 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Lin Zhang <xiaolou4617@...il.com>
Cc:     kbuild-all@...org, davem@...emloft.net, netdev@...r.kernel.org,
        courmisch@...il.com, Lin Zhang <xiaolou4617@...il.com>
Subject: Re: [PATCH 1/2] net: phonet: mark header_ops as const

Hi Lin,

[auto build test WARNING on net-next/master]
[also build test WARNING on v4.14-rc3 next-20170929]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Lin-Zhang/net-phonet-mark-header_ops-as-const/20171003-145726
config: i386-randconfig-x009-201740 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   net/phonet/af_phonet.c:152:25: error: conflicting type qualifiers for 'phonet_header_ops'
    const struct header_ops phonet_header_ops = {
                            ^~~~~~~~~~~~~~~~~
   In file included from net/phonet/af_phonet.c:32:0:
   include/linux/if_phonet.h:13:26: note: previous declaration of 'phonet_header_ops' was here
    extern struct header_ops phonet_header_ops;
                             ^~~~~~~~~~~~~~~~~
   In file included from include/linux/linkage.h:6:0,
                    from include/linux/kernel.h:6,
                    from net/phonet/af_phonet.c:26:
   net/phonet/af_phonet.c:156:15: error: conflicting type qualifiers for 'phonet_header_ops'
    EXPORT_SYMBOL(phonet_header_ops);
                  ^
   include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                        ^~~
>> net/phonet/af_phonet.c:156:1: note: in expansion of macro 'EXPORT_SYMBOL'
    EXPORT_SYMBOL(phonet_header_ops);
    ^~~~~~~~~~~~~
   In file included from net/phonet/af_phonet.c:32:0:
   include/linux/if_phonet.h:13:26: note: previous declaration of 'phonet_header_ops' was here
    extern struct header_ops phonet_header_ops;
                             ^~~~~~~~~~~~~~~~~

vim +/EXPORT_SYMBOL +156 net/phonet/af_phonet.c

4b07b3f69 Remi Denis-Courmont 2008-09-22  @26  #include <linux/kernel.h>
4b07b3f69 Remi Denis-Courmont 2008-09-22   27  #include <linux/module.h>
5a0e3ad6a Tejun Heo           2010-03-24   28  #include <linux/slab.h>
4b07b3f69 Remi Denis-Courmont 2008-09-22   29  #include <asm/unaligned.h>
4b07b3f69 Remi Denis-Courmont 2008-09-22   30  #include <net/sock.h>
4b07b3f69 Remi Denis-Courmont 2008-09-22   31  
4b07b3f69 Remi Denis-Courmont 2008-09-22   32  #include <linux/if_phonet.h>
4b07b3f69 Remi Denis-Courmont 2008-09-22   33  #include <linux/phonet.h>
4b07b3f69 Remi Denis-Courmont 2008-09-22   34  #include <net/phonet/phonet.h>
f8ff60283 Remi Denis-Courmont 2008-09-22   35  #include <net/phonet/pn_dev.h>
4b07b3f69 Remi Denis-Courmont 2008-09-22   36  
566521d63 Alexey Dobriyan     2008-11-19   37  /* Transport protocol registration */
566521d63 Alexey Dobriyan     2008-11-19   38  static struct phonet_protocol *proto_tab[PHONET_NPROTO] __read_mostly;
566521d63 Alexey Dobriyan     2008-11-19   39  
facb4edc1 Dan Carpenter       2011-01-10   40  static struct phonet_protocol *phonet_proto_get(unsigned int protocol)
566521d63 Alexey Dobriyan     2008-11-19   41  {
566521d63 Alexey Dobriyan     2008-11-19   42  	struct phonet_protocol *pp;
566521d63 Alexey Dobriyan     2008-11-19   43  
566521d63 Alexey Dobriyan     2008-11-19   44  	if (protocol >= PHONET_NPROTO)
566521d63 Alexey Dobriyan     2008-11-19   45  		return NULL;
566521d63 Alexey Dobriyan     2008-11-19   46  
7ed0132f2 Rémi Denis-Courmont 2009-11-13   47  	rcu_read_lock();
b2a5decdd Rémi Denis-Courmont 2009-11-16   48  	pp = rcu_dereference(proto_tab[protocol]);
566521d63 Alexey Dobriyan     2008-11-19   49  	if (pp && !try_module_get(pp->prot->owner))
566521d63 Alexey Dobriyan     2008-11-19   50  		pp = NULL;
7ed0132f2 Rémi Denis-Courmont 2009-11-13   51  	rcu_read_unlock();
566521d63 Alexey Dobriyan     2008-11-19   52  
566521d63 Alexey Dobriyan     2008-11-19   53  	return pp;
566521d63 Alexey Dobriyan     2008-11-19   54  }
566521d63 Alexey Dobriyan     2008-11-19   55  
566521d63 Alexey Dobriyan     2008-11-19   56  static inline void phonet_proto_put(struct phonet_protocol *pp)
566521d63 Alexey Dobriyan     2008-11-19   57  {
566521d63 Alexey Dobriyan     2008-11-19   58  	module_put(pp->prot->owner);
566521d63 Alexey Dobriyan     2008-11-19   59  }
4b07b3f69 Remi Denis-Courmont 2008-09-22   60  
4b07b3f69 Remi Denis-Courmont 2008-09-22   61  /* protocol family functions */
4b07b3f69 Remi Denis-Courmont 2008-09-22   62  
3f378b684 Eric Paris          2009-11-05   63  static int pn_socket_create(struct net *net, struct socket *sock, int protocol,
3f378b684 Eric Paris          2009-11-05   64  			    int kern)
4b07b3f69 Remi Denis-Courmont 2008-09-22   65  {
ba113a94b Remi Denis-Courmont 2008-09-22   66  	struct sock *sk;
ba113a94b Remi Denis-Courmont 2008-09-22   67  	struct pn_sock *pn;
4b07b3f69 Remi Denis-Courmont 2008-09-22   68  	struct phonet_protocol *pnp;
4b07b3f69 Remi Denis-Courmont 2008-09-22   69  	int err;
4b07b3f69 Remi Denis-Courmont 2008-09-22   70  
4b07b3f69 Remi Denis-Courmont 2008-09-22   71  	if (!capable(CAP_SYS_ADMIN))
4b07b3f69 Remi Denis-Courmont 2008-09-22   72  		return -EPERM;
4b07b3f69 Remi Denis-Courmont 2008-09-22   73  
4b07b3f69 Remi Denis-Courmont 2008-09-22   74  	if (protocol == 0) {
4b07b3f69 Remi Denis-Courmont 2008-09-22   75  		/* Default protocol selection */
4b07b3f69 Remi Denis-Courmont 2008-09-22   76  		switch (sock->type) {
4b07b3f69 Remi Denis-Courmont 2008-09-22   77  		case SOCK_DGRAM:
4b07b3f69 Remi Denis-Courmont 2008-09-22   78  			protocol = PN_PROTO_PHONET;
4b07b3f69 Remi Denis-Courmont 2008-09-22   79  			break;
9641458d3 Rémi Denis-Courmont 2008-10-05   80  		case SOCK_SEQPACKET:
9641458d3 Rémi Denis-Courmont 2008-10-05   81  			protocol = PN_PROTO_PIPE;
9641458d3 Rémi Denis-Courmont 2008-10-05   82  			break;
4b07b3f69 Remi Denis-Courmont 2008-09-22   83  		default:
4b07b3f69 Remi Denis-Courmont 2008-09-22   84  			return -EPROTONOSUPPORT;
4b07b3f69 Remi Denis-Courmont 2008-09-22   85  		}
4b07b3f69 Remi Denis-Courmont 2008-09-22   86  	}
4b07b3f69 Remi Denis-Courmont 2008-09-22   87  
4b07b3f69 Remi Denis-Courmont 2008-09-22   88  	pnp = phonet_proto_get(protocol);
25532824f Rémi Denis-Courmont 2008-10-05   89  	if (pnp == NULL &&
25532824f Rémi Denis-Courmont 2008-10-05   90  	    request_module("net-pf-%d-proto-%d", PF_PHONET, protocol) == 0)
25532824f Rémi Denis-Courmont 2008-10-05   91  		pnp = phonet_proto_get(protocol);
95a5afca4 Johannes Berg       2008-10-16   92  
4b07b3f69 Remi Denis-Courmont 2008-09-22   93  	if (pnp == NULL)
4b07b3f69 Remi Denis-Courmont 2008-09-22   94  		return -EPROTONOSUPPORT;
4b07b3f69 Remi Denis-Courmont 2008-09-22   95  	if (sock->type != pnp->sock_type) {
4b07b3f69 Remi Denis-Courmont 2008-09-22   96  		err = -EPROTONOSUPPORT;
4b07b3f69 Remi Denis-Courmont 2008-09-22   97  		goto out;
4b07b3f69 Remi Denis-Courmont 2008-09-22   98  	}
4b07b3f69 Remi Denis-Courmont 2008-09-22   99  
11aa9c28b Eric W. Biederman   2015-05-08  100  	sk = sk_alloc(net, PF_PHONET, GFP_KERNEL, pnp->prot, kern);
ba113a94b Remi Denis-Courmont 2008-09-22  101  	if (sk == NULL) {
ba113a94b Remi Denis-Courmont 2008-09-22  102  		err = -ENOMEM;
ba113a94b Remi Denis-Courmont 2008-09-22  103  		goto out;
ba113a94b Remi Denis-Courmont 2008-09-22  104  	}
ba113a94b Remi Denis-Courmont 2008-09-22  105  
ba113a94b Remi Denis-Courmont 2008-09-22  106  	sock_init_data(sock, sk);
ba113a94b Remi Denis-Courmont 2008-09-22  107  	sock->state = SS_UNCONNECTED;
ba113a94b Remi Denis-Courmont 2008-09-22  108  	sock->ops = pnp->ops;
ba113a94b Remi Denis-Courmont 2008-09-22  109  	sk->sk_backlog_rcv = sk->sk_prot->backlog_rcv;
ba113a94b Remi Denis-Courmont 2008-09-22  110  	sk->sk_protocol = protocol;
ba113a94b Remi Denis-Courmont 2008-09-22  111  	pn = pn_sk(sk);
ba113a94b Remi Denis-Courmont 2008-09-22  112  	pn->sobject = 0;
a8059512b Rémi Denis-Courmont 2011-02-24  113  	pn->dobject = 0;
ba113a94b Remi Denis-Courmont 2008-09-22  114  	pn->resource = 0;
ba113a94b Remi Denis-Courmont 2008-09-22  115  	sk->sk_prot->init(sk);
ba113a94b Remi Denis-Courmont 2008-09-22  116  	err = 0;
4b07b3f69 Remi Denis-Courmont 2008-09-22  117  
4b07b3f69 Remi Denis-Courmont 2008-09-22  118  out:
4b07b3f69 Remi Denis-Courmont 2008-09-22  119  	phonet_proto_put(pnp);
4b07b3f69 Remi Denis-Courmont 2008-09-22  120  	return err;
4b07b3f69 Remi Denis-Courmont 2008-09-22  121  }
4b07b3f69 Remi Denis-Courmont 2008-09-22  122  
ec1b4cf74 Stephen Hemminger   2009-10-05  123  static const struct net_proto_family phonet_proto_family = {
25532824f Rémi Denis-Courmont 2008-10-05  124  	.family = PF_PHONET,
4b07b3f69 Remi Denis-Courmont 2008-09-22  125  	.create = pn_socket_create,
4b07b3f69 Remi Denis-Courmont 2008-09-22  126  	.owner = THIS_MODULE,
4b07b3f69 Remi Denis-Courmont 2008-09-22  127  };
4b07b3f69 Remi Denis-Courmont 2008-09-22  128  
5f77076d7 Remi Denis-Courmont 2008-09-22  129  /* Phonet device header operations */
5f77076d7 Remi Denis-Courmont 2008-09-22  130  static int pn_header_create(struct sk_buff *skb, struct net_device *dev,
5f77076d7 Remi Denis-Courmont 2008-09-22  131  				unsigned short type, const void *daddr,
95c961747 Eric Dumazet        2012-04-15  132  				const void *saddr, unsigned int len)
5f77076d7 Remi Denis-Courmont 2008-09-22  133  {
5f77076d7 Remi Denis-Courmont 2008-09-22  134  	u8 *media = skb_push(skb, 1);
5f77076d7 Remi Denis-Courmont 2008-09-22  135  
5f77076d7 Remi Denis-Courmont 2008-09-22  136  	if (type != ETH_P_PHONET)
5f77076d7 Remi Denis-Courmont 2008-09-22  137  		return -1;
5f77076d7 Remi Denis-Courmont 2008-09-22  138  
5f77076d7 Remi Denis-Courmont 2008-09-22  139  	if (!saddr)
5f77076d7 Remi Denis-Courmont 2008-09-22  140  		saddr = dev->dev_addr;
5f77076d7 Remi Denis-Courmont 2008-09-22  141  	*media = *(const u8 *)saddr;
5f77076d7 Remi Denis-Courmont 2008-09-22  142  	return 1;
5f77076d7 Remi Denis-Courmont 2008-09-22  143  }
5f77076d7 Remi Denis-Courmont 2008-09-22  144  
5f77076d7 Remi Denis-Courmont 2008-09-22  145  static int pn_header_parse(const struct sk_buff *skb, unsigned char *haddr)
5f77076d7 Remi Denis-Courmont 2008-09-22  146  {
5f77076d7 Remi Denis-Courmont 2008-09-22  147  	const u8 *media = skb_mac_header(skb);
5f77076d7 Remi Denis-Courmont 2008-09-22  148  	*haddr = *media;
5f77076d7 Remi Denis-Courmont 2008-09-22  149  	return 1;
5f77076d7 Remi Denis-Courmont 2008-09-22  150  }
5f77076d7 Remi Denis-Courmont 2008-09-22  151  
9ffaa93ed Lin Zhang           2017-09-30  152  const struct header_ops phonet_header_ops = {
5f77076d7 Remi Denis-Courmont 2008-09-22  153  	.create = pn_header_create,
5f77076d7 Remi Denis-Courmont 2008-09-22  154  	.parse = pn_header_parse,
5f77076d7 Remi Denis-Courmont 2008-09-22  155  };
5f77076d7 Remi Denis-Courmont 2008-09-22 @156  EXPORT_SYMBOL(phonet_header_ops);
5f77076d7 Remi Denis-Courmont 2008-09-22  157  

:::::: The code at line 156 was first introduced by commit
:::::: 5f77076d75d35c9f5619e1f9d7e7428a627f65e6 Phonet: provide MAC header operations

:::::: TO: Remi Denis-Courmont <remi.denis-courmont@...ia.com>
:::::: CC: David S. Miller <davem@...emloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/gzip" (24579 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ