Skip to contentSkip to conversation

ethtool: improve compat ioctl handling

PATCH In review Arnd Bergmann 2 participants 5 messages Sep 25, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 ethtool: improve compat ioctl handling

The ethtool compat ioctl handling is hidden away in net/socket.c, which introduces a couple of minor oddities:

- The implementation may end up diverging, as seen in the RXNFC extension in commit 84a1d9c48200 ("net: ethtool: extend RXNFC API to support RSS spreading of filter matches") that does not work in compat mode.

- Most architectures do not need the compat handling at all because u64 and compat_u64 have the same alignment.

- On x86, the conversion is done for both x32 and i386 user space, but it's actually wrong to do it for x32 and cannot work there.

- On 32-bit Arm, it never worked for compat oabi user space, since that needs to do the same conversion but does not.

- It would be nice to get rid of both compat_alloc_user_space() and copy_in_user() throughout the kernel.

None of these actually seems to be a serious problem that real users are likely to encounter, but fixing all of them actually leads to code that is both shorter and more readable.

---
Changes in v2:
- remove extraneous 'inline' keyword (davem)
- split helper functions into smaller units (hch)
- remove arm oabi check with missing dependency (0day bot)

---
 include/linux/ethtool.h |   4 --
 net/ethtool/ioctl.c     | 143 +++++++++++++++++++++++++++++++++++-----
 net/socket.c            | 125 +----------------------------------
 3 files changed, 128 insertions(+), 144 deletions(-)
include/linux/ethtool.h +0 -4
index 060b20f0b20f..f989242ebaf8 100644
@@ -17,8 +17,6 @@
 #include <linux/compat.h>
 #include <uapi/linux/ethtool.h>
 
-#ifdef CONFIG_COMPAT
-
 struct compat_ethtool_rx_flow_spec {
 	u32		flow_type;
 	union ethtool_flow_union h_u;
@@ -38,8 +36,6 @@ struct compat_ethtool_rxnfc {
 	u32				rule_locs[];
 };
 
-#endif /* CONFIG_COMPAT */
-
 #include <linux/rculist.h>
 
 /**
net/ethtool/ioctl.c +127 -16

185 lines not on this page · raw message

net/socket.c +1 -124

143 lines not on this page · raw message

Signature · 1 line
2.27.0
#1 lore raw

PATCH v2 2/2 dev_ioctl: split out SIOC?IFMAP ioctls

The ifreq ioctls need a special compat handler at the moment because of the size difference between the struct on native and compat architectures, but this difference exists only for one pair of ioctls, SIOCGIFMAP and SIOCSIFMAP.

Splitting these two out of dev_ioctl() into their own higher level implementation means the ifreq structure can be redefined in the kernel to be identical for all applications, avoiding the need for copying the structure around multiple times, and removing one of the call sites for compat_alloc_user_space() and copy_in_user().

This should also make it easier for drivers to implement ioctls correct that take an ifreq __user pointer and need to be careful about the size difference. This has been a problem in the past, but currently the kernel does not appear to have any drivers suffering from it.

Note that the user space definition is unchanged, so struct ifreq now has a different size between user space and kernel, but this is not a problem when the user space definition is larger, and the only time the extra members are accessed is in the ifmap ioctls.

---
changes in v2:
- fix building with CONFIG_COMPAT disabled (0day bot)
- split up dev_ifmap() into more readable helpers (hch)
- move rcu_read_unlock() for readability (hch)

---
 include/linux/compat.h    |  18 +++---
 include/linux/netdevice.h |   1 +
 include/uapi/linux/if.h   |   6 ++
 net/core/dev_ioctl.c      | 122 ++++++++++++++++++++++++++++++++------
 net/socket.c              |  93 ++---------------------------
 5 files changed, 125 insertions(+), 115 deletions(-)
include/linux/compat.h +9 -9
index b354ce58966e..6359c51b748f 100644
@@ -91,6 +91,15 @@
 	static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
 #endif /* COMPAT_SYSCALL_DEFINEx */
 
+struct compat_ifmap {
+	compat_ulong_t mem_start;
+	compat_ulong_t mem_end;
+	unsigned short base_addr;
+	unsigned char irq;
+	unsigned char dma;
+	unsigned char port;
+};
+
 #ifdef CONFIG_COMPAT
 
 #ifndef compat_user_stack_pointer
@@ -314,15 +323,6 @@ typedef struct compat_sigevent {
 	} _sigev_un;
 } compat_sigevent_t;
 
-struct compat_ifmap {
-	compat_ulong_t mem_start;
-	compat_ulong_t mem_end;
-	unsigned short base_addr;
-	unsigned char irq;
-	unsigned char dma;
-	unsigned char port;
-};
-
 struct compat_if_settings {
 	unsigned int type;	/* Type of physical device or protocol */
 	unsigned int size;	/* Size of the data allocated by the caller */
include/linux/netdevice.h +1 -0
index a431c3229cbf..df4124442427 100644
@@ -3810,6 +3810,7 @@ void netdev_rx_handler_unregister(struct net_device *dev);
 bool dev_valid_name(const char *name);
 int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr,
 		bool *need_copyout);
+int dev_ifmap(struct net *net, struct ifreq __user *ifr, unsigned int cmd);
 int dev_ifconf(struct net *net, struct ifconf *, int);
 int dev_ethtool(struct net *net, struct ifreq *);
 unsigned int dev_get_flags(const struct net_device *);
include/uapi/linux/if.h +6 -0
index 797ba2c1562a..a332d6ae4dc6 100644
@@ -247,7 +247,13 @@ struct ifreq {
 		short	ifru_flags;
 		int	ifru_ivalue;
 		int	ifru_mtu;
+#ifndef __KERNEL__
+		/*
+		 * ifru_map is rarely used but causes the incompatibility
+		 * between native and compat mode.
+		 */
 		struct  ifmap ifru_map;
+#endif
 		char	ifru_slave[IFNAMSIZ];	/* Just fits the size */
 		char	ifru_newname[IFNAMSIZ];
 		void __user *	ifru_data;
net/core/dev_ioctl.c +103 -19

152 lines not on this page · raw message

net/socket.c +6 -87

123 lines not on this page · raw message

Signature · 1 line
2.27.0
#2 lore raw
In reply to Arnd Bergmann
I love your patch! Perhaps something to improve:

Hi Arnd,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/ethtool-improve-compat-ioctl-handling/20200925-212440
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git aafe8853f5e2bcbdd231411aec218b8c5dc78437
config: arm64-randconfig-r035-20200925 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c32e69b2ce7abfb151a87ba363ac9e25abf7d417)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/7a728784f051b3bce6ddedb8005b01d597e0342d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Arnd-Bergmann/ethtool-improve-compat-ioctl-handling/20200925-212440 git checkout 7a728784f051b3bce6ddedb8005b01d597e0342d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

In file included from drivers/net/wireless/marvell/mwifiex/sta_cmd.c:20:
In file included from drivers/net/wireless/marvell/mwifiex/decl.h:28:
In file included from include/linux/ieee80211.h:20:
In file included from include/linux/etherdevice.h:21:
In file included from include/linux/netdevice.h:37:
include/linux/ethtool.h:26:2: error: unknown type name 'compat_u64'

           compat_u64      ring_cookie;
           ^
   include/linux/ethtool.h:33:2: error: unknown type name 'compat_u64'
           compat_u64                      data;
           ^
>> drivers/net/wireless/marvell/mwifiex/sta_cmd.c:606:45: warning: implicit conversion from 'unsigned long' to '__u16' (aka 'unsigned short') changes value from 18446744073709551614 to 65534 [-Wconstant-conversion]
                   km->key_param_set.key_info &= cpu_to_le16(~KEY_MCAST);
                                                 ~~~~~~~~~~~~^~~~~~~~~~~
   include/linux/byteorder/generic.h:90:21: note: expanded from macro 'cpu_to_le16'
   #define cpu_to_le16 __cpu_to_le16
                       ^
   include/uapi/linux/byteorder/big_endian.h:35:53: note: expanded from macro '__cpu_to_le16'
   #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
                                             ~~~~~~~~~~^~~
   include/uapi/linux/swab.h:107:12: note: expanded from macro '__swab16'
           __fswab16(x))
           ~~~~~~~~~ ^

1 warning and 2 errors generated.
--
In file included from drivers/net/vmxnet3/vmxnet3_drv.c:28:
In file included from include/net/ip6_checksum.h:27:
In file included from include/net/ip.h:28:
In file included from include/net/inet_sock.h:19:
In file included from include/linux/netdevice.h:37:
include/linux/ethtool.h:26:2: error: unknown type name 'compat_u64'

           compat_u64      ring_cookie;
           ^
   include/linux/ethtool.h:33:2: error: unknown type name 'compat_u64'
           compat_u64                      data;
           ^
>> drivers/net/vmxnet3/vmxnet3_drv.c:3430:29: warning: shift count >= width of type [-Wshift-count-overflow]
           if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) == 0) {
                                      ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:139:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   drivers/net/vmxnet3/vmxnet3_drv.c:3431:41: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) {
                                                         ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:139:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~

2 warnings and 2 errors generated.
--
In file included from drivers/net/wireless/intel/iwlwifi/pcie/trans.c:74:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-trans.h:67:
In file included from include/linux/ieee80211.h:20:
In file included from include/linux/etherdevice.h:21:
In file included from include/linux/netdevice.h:37:
include/linux/ethtool.h:26:2: error: unknown type name 'compat_u64'

           compat_u64      ring_cookie;
           ^
   include/linux/ethtool.h:33:2: error: unknown type name 'compat_u64'
           compat_u64                      data;
           ^
>> drivers/net/wireless/intel/iwlwifi/pcie/trans.c:1923:35: warning: implicit conversion from 'unsigned long long' to 'u32' (aka 'unsigned int') changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
           trans_pcie->supported_dma_mask = DMA_BIT_MASK(12);
                                          ~ ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:139:40: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                          ^~~~~
   drivers/net/wireless/intel/iwlwifi/pcie/trans.c:1925:36: warning: implicit conversion from 'unsigned long long' to 'u32' (aka 'unsigned int') changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
                   trans_pcie->supported_dma_mask = DMA_BIT_MASK(11);
                                                  ~ ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:139:40: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                          ^~~~~

2 warnings and 2 errors generated.

vim +606 drivers/net/wireless/marvell/mwifiex/sta_cmd.c

5e6e3a92b9a4c94 drivers/net/wireless/mwifiex/sta_cmd.c         Bing Zhao      2011-03-21  588  
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  589  /* This function populates key material v2 command
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  590   * to set network key for AES & CMAC AES.
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  591   */
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  592  static int mwifiex_set_aes_key_v2(struct mwifiex_private *priv,
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  593  				  struct host_cmd_ds_command *cmd,
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  594  				  struct mwifiex_ds_encrypt_key *enc_key,
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  595  				  struct host_cmd_ds_802_11_key_material_v2 *km)
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  596  {
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  597  	struct mwifiex_adapter *adapter = priv->adapter;
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  598  	u16 size, len = KEY_PARAMS_FIXED_LEN;
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  599  
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  600  	if (enc_key->is_igtk_key) {
acebe8c10a6eabd drivers/net/wireless/mwifiex/sta_cmd.c         Zhaoyang Liu   2015-05-12  601  		mwifiex_dbg(adapter, INFO,
acebe8c10a6eabd drivers/net/wireless/mwifiex/sta_cmd.c         Zhaoyang Liu   2015-05-12  602  			    "%s: Set CMAC AES Key\n", __func__);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  603  		if (enc_key->is_rx_seq_valid)
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  604  			memcpy(km->key_param_set.key_params.cmac_aes.ipn,
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  605  			       enc_key->pn, enc_key->pn_len);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07 @606  		km->key_param_set.key_info &= cpu_to_le16(~KEY_MCAST);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  607  		km->key_param_set.key_info |= cpu_to_le16(KEY_IGTK);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  608  		km->key_param_set.key_type = KEY_TYPE_ID_AES_CMAC;
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  609  		km->key_param_set.key_params.cmac_aes.key_len =
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  610  					  cpu_to_le16(enc_key->key_len);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  611  		memcpy(km->key_param_set.key_params.cmac_aes.key,
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  612  		       enc_key->key_material, enc_key->key_len);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  613  		len += sizeof(struct mwifiex_cmac_aes_param);
89951db2be53106 drivers/net/wireless/marvell/mwifiex/sta_cmd.c Ganapathi Bhat 2016-09-20  614  	} else if (enc_key->is_igtk_def_key) {
89951db2be53106 drivers/net/wireless/marvell/mwifiex/sta_cmd.c Ganapathi Bhat 2016-09-20  615  		mwifiex_dbg(adapter, INFO,
89951db2be53106 drivers/net/wireless/marvell/mwifiex/sta_cmd.c Ganapathi Bhat 2016-09-20  616  			    "%s: Set CMAC default Key index\n", __func__);
89951db2be53106 drivers/net/wireless/marvell/mwifiex/sta_cmd.c Ganapathi Bhat 2016-09-20  617  		km->key_param_set.key_type = KEY_TYPE_ID_AES_CMAC_DEF;
89951db2be53106 drivers/net/wireless/marvell/mwifiex/sta_cmd.c Ganapathi Bhat 2016-09-20  618  		km->key_param_set.key_idx = enc_key->key_index & KEY_INDEX_MASK;
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  619  	} else {
acebe8c10a6eabd drivers/net/wireless/mwifiex/sta_cmd.c         Zhaoyang Liu   2015-05-12  620  		mwifiex_dbg(adapter, INFO,
acebe8c10a6eabd drivers/net/wireless/mwifiex/sta_cmd.c         Zhaoyang Liu   2015-05-12  621  			    "%s: Set AES Key\n", __func__);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  622  		if (enc_key->is_rx_seq_valid)
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  623  			memcpy(km->key_param_set.key_params.aes.pn,
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  624  			       enc_key->pn, enc_key->pn_len);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  625  		km->key_param_set.key_type = KEY_TYPE_ID_AES;
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  626  		km->key_param_set.key_params.aes.key_len =
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  627  					  cpu_to_le16(enc_key->key_len);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  628  		memcpy(km->key_param_set.key_params.aes.key,
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  629  		       enc_key->key_material, enc_key->key_len);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  630  		len += sizeof(struct mwifiex_aes_param);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  631  	}
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  632  
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  633  	km->key_param_set.len = cpu_to_le16(len);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  634  	size = len + sizeof(struct mwifiex_ie_types_header) +
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  635  	       sizeof(km->action) + S_DS_GEN;
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  636  	cmd->size = cpu_to_le16(size);
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  637  
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  638  	return 0;
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  639  }
e57f1734d87aa0e drivers/net/wireless/mwifiex/sta_cmd.c         Avinash Patil  2014-02-07  640  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#3 lore raw
In reply to Arnd Bergmann
Quoted 21 lines · Arnd Bergmann

The ethtool compat ioctl handling is hidden away in net/socket.c, which introduces a couple of minor oddities:

- The implementation may end up diverging, as seen in the RXNFC extension in commit 84a1d9c48200 ("net: ethtool: extend RXNFC API to support RSS spreading of filter matches") that does not work in compat mode.

- Most architectures do not need the compat handling at all because u64 and compat_u64 have the same alignment.

- On x86, the conversion is done for both x32 and i386 user space, but it's actually wrong to do it for x32 and cannot work there.

- On 32-bit Arm, it never worked for compat oabi user space, since that needs to do the same conversion but does not.

- It would be nice to get rid of both compat_alloc_user_space() and copy_in_user() throughout the kernel.

Quoted 6 lines

None of these actually seems to be a serious problem that real users are likely to encounter, but fixing all of them actually leads to code that is both shorter and more readable.

The kbuild bot found another dependency on a patch that I had in my testing tree (moving compat_u64). Let's drop both patches for now, I'll resend once that has been merged.

Arnd

#4 lore raw
In reply to Arnd Bergmann
I love your patch! Perhaps something to improve:

Hi Arnd,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/ethtool-improve-compat-ioctl-handling/20200925-212440
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git aafe8853f5e2bcbdd231411aec218b8c5dc78437
config: arm64-randconfig-r032-20200925 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c32e69b2ce7abfb151a87ba363ac9e25abf7d417)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/7a728784f051b3bce6ddedb8005b01d597e0342d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Arnd-Bergmann/ethtool-improve-compat-ioctl-handling/20200925-212440 git checkout 7a728784f051b3bce6ddedb8005b01d597e0342d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

In file included from drivers/net/ethernet/apm/xgene-v2/main.c:10:
In file included from drivers/net/ethernet/apm/xgene-v2/main.h:16:
In file included from include/linux/if_vlan.h:10:
In file included from include/linux/netdevice.h:37:
include/linux/ethtool.h:26:2: error: unknown type name 'compat_u64'

           compat_u64      ring_cookie;
           ^
   include/linux/ethtool.h:33:2: error: unknown type name 'compat_u64'
           compat_u64                      data;
           ^
>> drivers/net/ethernet/apm/xgene-v2/main.c:661:42: warning: shift count >= width of type [-Wshift-count-overflow]
           ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
                                                   ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:139:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~

1 warning and 2 errors generated.

vim +661 drivers/net/ethernet/apm/xgene-v2/main.c

3b3f9a75d93186 Iyappan Subramanian 2017-03-07  631  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  632  static int xge_probe(struct platform_device *pdev)
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  633  {
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  634  	struct device *dev = &pdev->dev;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  635  	struct net_device *ndev;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  636  	struct xge_pdata *pdata;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  637  	int ret;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  638  
1ffa8a7aa51647 Iyappan Subramanian 2017-03-21  639  	ndev = alloc_etherdev(sizeof(*pdata));
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  640  	if (!ndev)
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  641  		return -ENOMEM;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  642  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  643  	pdata = netdev_priv(ndev);
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  644  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  645  	pdata->pdev = pdev;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  646  	pdata->ndev = ndev;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  647  	SET_NETDEV_DEV(ndev, dev);
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  648  	platform_set_drvdata(pdev, pdata);
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  649  	ndev->netdev_ops = &xgene_ndev_ops;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  650  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  651  	ndev->features |= NETIF_F_GSO |
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  652  			  NETIF_F_GRO;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  653  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  654  	ret = xge_get_resources(pdata);
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  655  	if (ret)
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  656  		goto err;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  657  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  658  	ndev->hw_features = ndev->features;
617d795c7cb2d1 Iyappan Subramanian 2017-03-21  659  	xge_set_ethtool_ops(ndev);
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  660  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07 @661  	ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  662  	if (ret) {
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  663  		netdev_err(ndev, "No usable DMA configuration\n");
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  664  		goto err;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  665  	}
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  666  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  667  	ret = xge_init_hw(ndev);
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  668  	if (ret)
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  669  		goto err;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  670  
ea8ab16ab225a6 Iyappan Subramanian 2017-03-21  671  	ret = xge_mdio_config(ndev);
ea8ab16ab225a6 Iyappan Subramanian 2017-03-21  672  	if (ret)
ea8ab16ab225a6 Iyappan Subramanian 2017-03-21  673  		goto err;
ea8ab16ab225a6 Iyappan Subramanian 2017-03-21  674  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  675  	netif_napi_add(ndev, &pdata->napi, xge_napi, NAPI_POLL_WEIGHT);
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  676  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  677  	ret = register_netdev(ndev);
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  678  	if (ret) {
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  679  		netdev_err(ndev, "Failed to register netdev\n");
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  680  		goto err;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  681  	}
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  682  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  683  	return 0;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  684  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  685  err:
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  686  	free_netdev(ndev);
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  687  
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  688  	return ret;
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  689  }
3b3f9a75d93186 Iyappan Subramanian 2017-03-07  690  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org