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>] [day] [month] [year] [list]
Message-Id: <20211207025421.1903782-1-liuhangbin@gmail.com>
Date:   Tue,  7 Dec 2021 10:54:21 +0800
From:   Hangbin Liu <liuhangbin@...il.com>
To:     wireguard@...ts.zx2c4.com
Cc:     netdev@...r.kernel.org, "Jason A . Donenfeld" <Jason@...c4.com>,
        Toke Høiland-Jørgensen <toke@...hat.com>,
        Hangbin Liu <liuhangbin@...il.com>
Subject: [PATCH wireguard] wireguard: remove redundancy include files

Remove redundancy include files based on tool include-what-you-use
result. The tool will suggest using direct include headers and removing
some big headers. e.g. it will suggests to use linux/spinlock_types.h
for spinlock_t. But actually, we only need to include linux/spinlock.h
directly. So I just take the result as a reference and remove the include
files I do not find related structure/functions.

Tested with gcc-8.5.0 and the compilation passed.

Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
---
 drivers/net/wireguard/device.c   | 1 -
 drivers/net/wireguard/device.h   | 1 -
 drivers/net/wireguard/noise.c    | 4 ----
 drivers/net/wireguard/noise.h    | 1 -
 drivers/net/wireguard/peer.h     | 1 -
 drivers/net/wireguard/queueing.h | 2 --
 drivers/net/wireguard/send.c     | 5 -----
 drivers/net/wireguard/socket.c   | 2 --
 drivers/net/wireguard/socket.h   | 5 -----
 9 files changed, 22 deletions(-)

diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c
index a46067c38bf5..06b74da2133f 100644
--- a/drivers/net/wireguard/device.c
+++ b/drivers/net/wireguard/device.c
@@ -11,7 +11,6 @@
 #include "peer.h"
 #include "messages.h"
 
-#include <linux/module.h>
 #include <linux/rtnetlink.h>
 #include <linux/inet.h>
 #include <linux/netdevice.h>
diff --git a/drivers/net/wireguard/device.h b/drivers/net/wireguard/device.h
index 43c7cebbf50b..0782dcef9fc1 100644
--- a/drivers/net/wireguard/device.h
+++ b/drivers/net/wireguard/device.h
@@ -8,7 +8,6 @@
 
 #include "noise.h"
 #include "allowedips.h"
-#include "peerlookup.h"
 #include "cookie.h"
 
 #include <linux/types.h>
diff --git a/drivers/net/wireguard/noise.c b/drivers/net/wireguard/noise.c
index c0cfd9b36c0b..59be94077767 100644
--- a/drivers/net/wireguard/noise.c
+++ b/drivers/net/wireguard/noise.c
@@ -7,14 +7,10 @@
 #include "device.h"
 #include "peer.h"
 #include "messages.h"
-#include "queueing.h"
 #include "peerlookup.h"
 
 #include <linux/rcupdate.h>
 #include <linux/slab.h>
-#include <linux/bitmap.h>
-#include <linux/scatterlist.h>
-#include <linux/highmem.h>
 #include <crypto/algapi.h>
 
 /* This implements Noise_IKpsk2:
diff --git a/drivers/net/wireguard/noise.h b/drivers/net/wireguard/noise.h
index c527253dba80..75b8f0d50084 100644
--- a/drivers/net/wireguard/noise.h
+++ b/drivers/net/wireguard/noise.h
@@ -12,7 +12,6 @@
 #include <linux/spinlock.h>
 #include <linux/atomic.h>
 #include <linux/rwsem.h>
-#include <linux/mutex.h>
 #include <linux/kref.h>
 
 struct noise_replay_counter {
diff --git a/drivers/net/wireguard/peer.h b/drivers/net/wireguard/peer.h
index 76e4d3128ad4..05af76b62583 100644
--- a/drivers/net/wireguard/peer.h
+++ b/drivers/net/wireguard/peer.h
@@ -11,7 +11,6 @@
 #include "cookie.h"
 
 #include <linux/types.h>
-#include <linux/netfilter.h>
 #include <linux/spinlock.h>
 #include <linux/kref.h>
 #include <net/dst_cache.h>
diff --git a/drivers/net/wireguard/queueing.h b/drivers/net/wireguard/queueing.h
index e2388107f7fd..bd54373b4485 100644
--- a/drivers/net/wireguard/queueing.h
+++ b/drivers/net/wireguard/queueing.h
@@ -9,8 +9,6 @@
 #include "peer.h"
 #include <linux/types.h>
 #include <linux/skbuff.h>
-#include <linux/ip.h>
-#include <linux/ipv6.h>
 #include <net/ip_tunnels.h>
 
 struct wg_device;
diff --git a/drivers/net/wireguard/send.c b/drivers/net/wireguard/send.c
index 5368f7c35b4b..f5b25f6fc55b 100644
--- a/drivers/net/wireguard/send.c
+++ b/drivers/net/wireguard/send.c
@@ -11,12 +11,7 @@
 #include "messages.h"
 #include "cookie.h"
 
-#include <linux/uio.h>
-#include <linux/inetdevice.h>
-#include <linux/socket.h>
 #include <net/ip_tunnels.h>
-#include <net/udp.h>
-#include <net/sock.h>
 
 static void wg_packet_send_handshake_initiation(struct wg_peer *peer)
 {
diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c
index 6f07b949cb81..0d645613349a 100644
--- a/drivers/net/wireguard/socket.c
+++ b/drivers/net/wireguard/socket.c
@@ -9,9 +9,7 @@
 #include "queueing.h"
 #include "messages.h"
 
-#include <linux/ctype.h>
 #include <linux/net.h>
-#include <linux/if_vlan.h>
 #include <linux/if_ether.h>
 #include <linux/inetdevice.h>
 #include <net/udp_tunnel.h>
diff --git a/drivers/net/wireguard/socket.h b/drivers/net/wireguard/socket.h
index bab5848efbcd..d69c84f12e66 100644
--- a/drivers/net/wireguard/socket.h
+++ b/drivers/net/wireguard/socket.h
@@ -6,11 +6,6 @@
 #ifndef _WG_SOCKET_H
 #define _WG_SOCKET_H
 
-#include <linux/netdevice.h>
-#include <linux/udp.h>
-#include <linux/if_vlan.h>
-#include <linux/if_ether.h>
-
 int wg_socket_init(struct wg_device *wg, u16 port);
 void wg_socket_reinit(struct wg_device *wg, struct sock *new4,
 		      struct sock *new6);
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ