[PATCH v2 net-next 0/2] net: socket: use BIT() for MSG_* and fix MSG_CMSG_COMPAT

2021-03-21 Thread menglong8 . dong
From: Menglong Dong 

In the first patch, I use BIT() for MSG_* to make the code tidier.

Directly use BIT() for MSG_* will be a bit problematic, because
'msg_flags' is defined as 'int' somewhere, and MSG_CMSG_COMPAT
will make it become negative, just like what Guenter Roeck
reported here:

https://lore.kernel.org/netdev/20210317013758.ga134...@roeck-us.net

So in the second patch, I change MSG_CMSG_COMPAT to BIT(21), as
David Laight suggested. MSG_CMSG_COMPAT is an internal value,
which is't used in userspace, so this change works.

In version 2, some comment is added in patch 2 to stop people
from using BIT(31) for MSG_* in the feature, as Herbert Xu
suggested.


Menglong Dong (2):
  net: socket: use BIT() for MSG_*
  net: socket: change MSG_CMSG_COMPAT to BIT(21)

 include/linux/socket.h | 75 +++---
 1 file changed, 41 insertions(+), 34 deletions(-)

-- 
2.31.0



[PATCH v2 net-next 2/2] net: socket: change MSG_CMSG_COMPAT to BIT(21)

2021-03-21 Thread menglong8 . dong
From: Menglong Dong 

Currently, MSG_CMSG_COMPAT is defined as '1 << 31'. However, 'msg_flags'
is defined with type of 'int' somewhere, such as 'packet_recvmsg' and
other recvmsg functions:

static int packet_recvmsg(struct socket *sock, struct msghdr *msg,
  size_t len,
  int flags)

If MSG_CMSG_COMPAT is set in 'flags', it's value will be negative.
Once it perform bit operations with MSG_*, the upper 32 bits of
the result will be set, just like what Guenter Roeck explained
here:

https://lore.kernel.org/netdev/20210317013758.ga134...@roeck-us.net

As David Laight suggested, fix this by change MSG_CMSG_COMPAT to
some value else. MSG_CMSG_COMPAT is an internal value, which is't
used in userspace, so this change works.

Reported-by: Guenter Roeck 
Signed-off-by: Menglong Dong 
---
v2:
- add comment to stop people from trying to use BIT(31)
---
 include/linux/socket.h | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/linux/socket.h b/include/linux/socket.h
index d5ebfe30d96b..61b2694d68dd 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -312,17 +312,21 @@ struct ucred {
 * plain text and require encryption
 */
 
+#if defined(CONFIG_COMPAT)
+#define MSG_CMSG_COMPATBIT(21) /* This message needs 32 bit 
fixups */
+#else
+#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
+#endif
+
 #define MSG_ZEROCOPY   BIT(26) /* Use user data in kernel path */
 #define MSG_FASTOPEN   BIT(29) /* Send data in TCP SYN */
 #define MSG_CMSG_CLOEXEC   BIT(30) /* Set close_on_exec for file
 * descriptor received through
 * SCM_RIGHTS
 */
-#if defined(CONFIG_COMPAT)
-#define MSG_CMSG_COMPATBIT(31) /* This message needs 32 bit 
fixups */
-#else
-#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
-#endif
+/* Attention: Don't use BIT(31) for MSG_*, as 'msg_flags' is defined
+ * as 'int' somewhere and BIT(31) will make it become negative.
+ */
 
 
 /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
-- 
2.31.0



[PATCH v2 net-next 1/2] net: socket: use BIT() for MSG_*

2021-03-21 Thread menglong8 . dong
From: Menglong Dong 

The bit mask for MSG_* seems a little confused here. Replace it
with BIT() to make it clear to understand.

Signed-off-by: Menglong Dong 
---
 include/linux/socket.h | 71 ++
 1 file changed, 37 insertions(+), 34 deletions(-)

diff --git a/include/linux/socket.h b/include/linux/socket.h
index 385894b4a8bb..d5ebfe30d96b 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -283,42 +283,45 @@ struct ucred {
Added those for 1003.1g not all are supported yet
  */
 
-#define MSG_OOB1
-#define MSG_PEEK   2
-#define MSG_DONTROUTE  4
-#define MSG_TRYHARD 4   /* Synonym for MSG_DONTROUTE for DECnet */
-#define MSG_CTRUNC 8
-#define MSG_PROBE  0x10/* Do not send. Only probe path f.e. for MTU */
-#define MSG_TRUNC  0x20
-#define MSG_DONTWAIT   0x40/* Nonblocking io*/
-#define MSG_EOR 0x80   /* End of record */
-#define MSG_WAITALL0x100   /* Wait for a full request */
-#define MSG_FIN 0x200
-#define MSG_SYN0x400
-#define MSG_CONFIRM0x800   /* Confirm path validity */
-#define MSG_RST0x1000
-#define MSG_ERRQUEUE   0x2000  /* Fetch message from error queue */
-#define MSG_NOSIGNAL   0x4000  /* Do not generate SIGPIPE */
-#define MSG_MORE   0x8000  /* Sender will send more */
-#define MSG_WAITFORONE 0x1 /* recvmmsg(): block until 1+ packets avail */
-#define MSG_SENDPAGE_NOPOLICY 0x1 /* sendpage() internal : do no apply 
policy */
-#define MSG_SENDPAGE_NOTLAST 0x2 /* sendpage() internal : not the last 
page */
-#define MSG_BATCH  0x4 /* sendmmsg(): more messages coming */
-#define MSG_EOF MSG_FIN
-#define MSG_NO_SHARED_FRAGS 0x8 /* sendpage() internal : page frags are 
not shared */
-#define MSG_SENDPAGE_DECRYPTED 0x10 /* sendpage() internal : page may carry
- * plain text and require encryption
- */
-
-#define MSG_ZEROCOPY   0x400   /* Use user data in kernel path */
-#define MSG_FASTOPEN   0x2000  /* Send data in TCP SYN */
-#define MSG_CMSG_CLOEXEC 0x4000/* Set close_on_exec for file
-  descriptor received through
-  SCM_RIGHTS */
+#define MSG_OOBBIT(0)
+#define MSG_PEEK   BIT(1)
+#define MSG_DONTROUTE  BIT(2)
+#define MSG_TRYHARDBIT(2)  /* Synonym for MSG_DONTROUTE for DECnet 
*/
+#define MSG_CTRUNC BIT(3)
+#define MSG_PROBE  BIT(4)  /* Do not send. Only probe path f.e. for MTU
*/
+#define MSG_TRUNC  BIT(5)
+#define MSG_DONTWAIT   BIT(6)  /* Nonblocking io   */
+#define MSG_EORBIT(7)  /* End of record*/
+#define MSG_WAITALLBIT(8)  /* Wait for a full request  */
+#define MSG_FINBIT(9)
+#define MSG_SYNBIT(10)
+#define MSG_CONFIRMBIT(11) /* Confirm path validity*/
+#define MSG_RSTBIT(12)
+#define MSG_ERRQUEUE   BIT(13) /* Fetch message from error queue */
+#define MSG_NOSIGNAL   BIT(14) /* Do not generate SIGPIPE  */
+#define MSG_MORE   BIT(15) /* Sender will send more*/
+#define MSG_WAITFORONE BIT(16) /* recvmmsg(): block until 1+ packets avail */
+#define MSG_SENDPAGE_NOPOLICY  BIT(16) /* sendpage() internal : do no apply 
policy */
+#define MSG_SENDPAGE_NOTLAST   BIT(17) /* sendpage() internal : not the last 
page  */
+#define MSG_BATCH  BIT(18) /* sendmmsg(): more messages coming */
+#define MSG_EOFMSG_FIN
+#define MSG_NO_SHARED_FRAGSBIT(19) /* sendpage() internal : page frags
+* are not shared
+*/
+#define MSG_SENDPAGE_DECRYPTED BIT(20) /* sendpage() internal : page may carry
+* plain text and require encryption
+*/
+
+#define MSG_ZEROCOPY   BIT(26) /* Use user data in kernel path */
+#define MSG_FASTOPEN   BIT(29) /* Send data in TCP SYN */
+#define MSG_CMSG_CLOEXEC   BIT(30) /* Set close_on_exec for file
+* descriptor received through
+* SCM_RIGHTS
+*/
 #if defined(CONFIG_COMPAT)
-#define MSG_CMSG_COMPAT0x8000  /* This message needs 32 bit 
fixups */
+#define MSG_CMSG_COMPATBIT(31) /* This message needs 32 bit 
fixups */
 #else
-#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
+#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
 #endif
 
 
-- 
2.30.2



[PATCH net-next 2/2] net: socket: change MSG_CMSG_COMPAT to BIT(21)

2021-03-21 Thread menglong8 . dong
From: Menglong Dong 

Currently, MSG_CMSG_COMPAT is defined as '1 << 31'. However, 'msg_flags'
is defined with type of 'int' somewhere, such as 'packet_recvmsg' and
other recvmsg functions:

static int packet_recvmsg(struct socket *sock, struct msghdr *msg,
  size_t len,
  int flags)

If MSG_CMSG_COMPAT is set in 'flags', it's value will be negative.
Once it perform bit operations with MSG_*, the upper 32 bits of
the result will be set, just like what Guenter Roeck explained
here:

https://lore.kernel.org/netdev/20210317013758.ga134...@roeck-us.net

As David Laight suggested, fix this by change MSG_CMSG_COMPAT to
some value else. MSG_CMSG_COMPAT is an internal value, which is't
used in userspace, so this change works.

Reported-by: Guenter Roeck 
Signed-off-by: Menglong Dong 
---
 include/linux/socket.h | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/linux/socket.h b/include/linux/socket.h
index d5ebfe30d96b..317b2933f499 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -312,17 +312,18 @@ struct ucred {
 * plain text and require encryption
 */
 
+#if defined(CONFIG_COMPAT)
+#define MSG_CMSG_COMPATBIT(21) /* This message needs 32 bit 
fixups */
+#else
+#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
+#endif
+
 #define MSG_ZEROCOPY   BIT(26) /* Use user data in kernel path */
 #define MSG_FASTOPEN   BIT(29) /* Send data in TCP SYN */
 #define MSG_CMSG_CLOEXEC   BIT(30) /* Set close_on_exec for file
 * descriptor received through
 * SCM_RIGHTS
 */
-#if defined(CONFIG_COMPAT)
-#define MSG_CMSG_COMPATBIT(31) /* This message needs 32 bit 
fixups */
-#else
-#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
-#endif
 
 
 /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
-- 
2.31.0



[PATCH net-next 1/2] net: socket: use BIT() for MSG_*

2021-03-21 Thread menglong8 . dong
From: Menglong Dong 

The bit mask for MSG_* seems a little confused here. Replace it
with BIT() to make it clear to understand.

Signed-off-by: Menglong Dong 
---
 include/linux/socket.h | 71 ++
 1 file changed, 37 insertions(+), 34 deletions(-)

diff --git a/include/linux/socket.h b/include/linux/socket.h
index 385894b4a8bb..d5ebfe30d96b 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -283,42 +283,45 @@ struct ucred {
Added those for 1003.1g not all are supported yet
  */
 
-#define MSG_OOB1
-#define MSG_PEEK   2
-#define MSG_DONTROUTE  4
-#define MSG_TRYHARD 4   /* Synonym for MSG_DONTROUTE for DECnet */
-#define MSG_CTRUNC 8
-#define MSG_PROBE  0x10/* Do not send. Only probe path f.e. for MTU */
-#define MSG_TRUNC  0x20
-#define MSG_DONTWAIT   0x40/* Nonblocking io*/
-#define MSG_EOR 0x80   /* End of record */
-#define MSG_WAITALL0x100   /* Wait for a full request */
-#define MSG_FIN 0x200
-#define MSG_SYN0x400
-#define MSG_CONFIRM0x800   /* Confirm path validity */
-#define MSG_RST0x1000
-#define MSG_ERRQUEUE   0x2000  /* Fetch message from error queue */
-#define MSG_NOSIGNAL   0x4000  /* Do not generate SIGPIPE */
-#define MSG_MORE   0x8000  /* Sender will send more */
-#define MSG_WAITFORONE 0x1 /* recvmmsg(): block until 1+ packets avail */
-#define MSG_SENDPAGE_NOPOLICY 0x1 /* sendpage() internal : do no apply 
policy */
-#define MSG_SENDPAGE_NOTLAST 0x2 /* sendpage() internal : not the last 
page */
-#define MSG_BATCH  0x4 /* sendmmsg(): more messages coming */
-#define MSG_EOF MSG_FIN
-#define MSG_NO_SHARED_FRAGS 0x8 /* sendpage() internal : page frags are 
not shared */
-#define MSG_SENDPAGE_DECRYPTED 0x10 /* sendpage() internal : page may carry
- * plain text and require encryption
- */
-
-#define MSG_ZEROCOPY   0x400   /* Use user data in kernel path */
-#define MSG_FASTOPEN   0x2000  /* Send data in TCP SYN */
-#define MSG_CMSG_CLOEXEC 0x4000/* Set close_on_exec for file
-  descriptor received through
-  SCM_RIGHTS */
+#define MSG_OOBBIT(0)
+#define MSG_PEEK   BIT(1)
+#define MSG_DONTROUTE  BIT(2)
+#define MSG_TRYHARDBIT(2)  /* Synonym for MSG_DONTROUTE for DECnet 
*/
+#define MSG_CTRUNC BIT(3)
+#define MSG_PROBE  BIT(4)  /* Do not send. Only probe path f.e. for MTU
*/
+#define MSG_TRUNC  BIT(5)
+#define MSG_DONTWAIT   BIT(6)  /* Nonblocking io   */
+#define MSG_EORBIT(7)  /* End of record*/
+#define MSG_WAITALLBIT(8)  /* Wait for a full request  */
+#define MSG_FINBIT(9)
+#define MSG_SYNBIT(10)
+#define MSG_CONFIRMBIT(11) /* Confirm path validity*/
+#define MSG_RSTBIT(12)
+#define MSG_ERRQUEUE   BIT(13) /* Fetch message from error queue */
+#define MSG_NOSIGNAL   BIT(14) /* Do not generate SIGPIPE  */
+#define MSG_MORE   BIT(15) /* Sender will send more*/
+#define MSG_WAITFORONE BIT(16) /* recvmmsg(): block until 1+ packets avail */
+#define MSG_SENDPAGE_NOPOLICY  BIT(16) /* sendpage() internal : do no apply 
policy */
+#define MSG_SENDPAGE_NOTLAST   BIT(17) /* sendpage() internal : not the last 
page  */
+#define MSG_BATCH  BIT(18) /* sendmmsg(): more messages coming */
+#define MSG_EOFMSG_FIN
+#define MSG_NO_SHARED_FRAGSBIT(19) /* sendpage() internal : page frags
+* are not shared
+*/
+#define MSG_SENDPAGE_DECRYPTED BIT(20) /* sendpage() internal : page may carry
+* plain text and require encryption
+*/
+
+#define MSG_ZEROCOPY   BIT(26) /* Use user data in kernel path */
+#define MSG_FASTOPEN   BIT(29) /* Send data in TCP SYN */
+#define MSG_CMSG_CLOEXEC   BIT(30) /* Set close_on_exec for file
+* descriptor received through
+* SCM_RIGHTS
+*/
 #if defined(CONFIG_COMPAT)
-#define MSG_CMSG_COMPAT0x8000  /* This message needs 32 bit 
fixups */
+#define MSG_CMSG_COMPATBIT(31) /* This message needs 32 bit 
fixups */
 #else
-#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
+#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
 #endif
 
 
-- 
2.30.2



[PATCH net-next 0/2] net: socket: use BIT() for MSG_* and fix MSG_CMSG_COMPAT

2021-03-21 Thread menglong8 . dong
From: Menglong Dong 

In the first patch, I use BIT() for MSG_* to make the code tidier.

Directly use BIT() for MSG_* will be a bit problematic, because
'msg_flags' is defined as 'int' somewhere, and MSG_CMSG_COMPAT
will make it become negative, just like what Guenter Roeck
reported here:

https://lore.kernel.org/netdev/20210317013758.ga134...@roeck-us.net

So in the second patch, I change MSG_CMSG_COMPAT to BIT(21), as
David Laight suggested. MSG_CMSG_COMPAT is an internal value,
which is't used in userspace, so this change works.


Menglong Dong (2):
  net: socket: use BIT() for MSG_*
  net: socket: change MSG_CMSG_COMPAT to BIT(21)

 include/linux/socket.h | 72 ++
 1 file changed, 38 insertions(+), 34 deletions(-)

-- 
2.31.0



[PATCH] phy:qualcomm: remove duplicate argument

2021-03-19 Thread menglong8 . dong
From: Zhang Yunkai 

'HSUSB_CTRL_DPSEHV_CLAMP' in 'val' is duplicated.

Signed-off-by: Zhang Yunkai 
---
 drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c 
b/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c
index 9061ece7ff6a..bfff0c8c9130 100644
--- a/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c
@@ -276,8 +276,8 @@ static int qcom_ipq806x_usb_hs_phy_init(struct phy *phy)
val = HSUSB_CTRL_DPSEHV_CLAMP | HSUSB_CTRL_DMSEHV_CLAMP |
HSUSB_CTRL_RETENABLEN  | HSUSB_CTRL_COMMONONN |
HSUSB_CTRL_OTGSESSVLD_CLAMP | HSUSB_CTRL_ID_HV_CLAMP |
-   HSUSB_CTRL_DPSEHV_CLAMP | HSUSB_CTRL_UTMI_OTG_VBUS_VALID |
-   HSUSB_CTRL_UTMI_CLK_EN | HSUSB_CTRL_CLAMP_EN | 0x70;
+   HSUSB_CTRL_UTMI_OTG_VBUS_VALID | HSUSB_CTRL_UTMI_CLK_EN |
+   HSUSB_CTRL_CLAMP_EN | 0x70;
 
/* use core clock if external reference is not present */
if (!phy_dwc3->xo_clk)
-- 
2.25.1



[PATCH] fs/cifs/: fix misspellings using codespell tool

2021-03-18 Thread menglong8 . dong
From: Liu xuzhi 

A typo is found out by codespell tool in 251th lines of cifs_swn.c:

$ codespell ./fs/cifs/
./cifs_swn.c:251: funciton  ==> function

Fix a typo found by codespell.

Signed-off-by: Liu xuzhi 
---
 fs/cifs/cifs_swn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/cifs_swn.c b/fs/cifs/cifs_swn.c
index f2d730fffccb..d829b8bf833e 100644
--- a/fs/cifs/cifs_swn.c
+++ b/fs/cifs/cifs_swn.c
@@ -248,7 +248,7 @@ static int cifs_swn_send_unregister_message(struct 
cifs_swn_reg *swnreg)
 
 /*
  * Try to find a matching registration for the tcon's server name and share 
name.
- * Calls to this funciton must be protected by cifs_swnreg_idr_mutex.
+ * Calls to this function must be protected by cifs_swnreg_idr_mutex.
  * TODO Try to avoid memory allocations
  */
 static struct cifs_swn_reg *cifs_find_swn_reg(struct cifs_tcon *tcon)
-- 
2.25.1



[PATCH] fs/ext2/: fix misspellings using codespell tool

2021-03-18 Thread menglong8 . dong
From: Liu xuzhi 

A typo is found out by codespell tool in 1107th lines of super.c:

$ codespell ./fs/ext2/
./super.c:1107: fileystem  ==> filesystem

Fix a typo found by codespell.

Signed-off-by: Liu xuzhi 
---
 fs/ext2/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 6c4753277916..d2fd9707e953 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1104,7 +1104,7 @@ static int ext2_fill_super(struct super_block *sb, void 
*data, int silent)
get_random_bytes(>s_next_generation, sizeof(u32));
spin_lock_init(>s_next_gen_lock);
 
-   /* per fileystem reservation list head & lock */
+   /* per filesystem reservation list head & lock */
spin_lock_init(>s_rsv_window_lock);
sbi->s_rsv_window_root = RB_ROOT;
/*
-- 
2.25.1



[PATCH] security: fix misspellings using codespell tool

2021-03-18 Thread menglong8 . dong
From: Xiong Zhenwu 

A typo is found out by codespell tool:

$ codespell ./security

./security/commoncap.c:1135: capabilties  ==> capabilities

Fix a typo found by codespell.

Signed-off-by: Xiong Zhenwu 
---
 security/commoncap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/commoncap.c b/security/commoncap.c
index 1c519c875217..598d077572c0 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -1132,7 +1132,7 @@ int cap_task_fix_setuid(struct cred *new, const struct 
cred *old, int flags)
break;
 
case LSM_SETID_FS:
-   /* juggle the capabilties to follow FSUID changes, unless
+   /* juggle the capabilities to follow FSUID changes, unless
 * otherwise suppressed
 *
 * FIXME - is fsuser used for all CAP_FS_MASK capabilities?
-- 
2.25.1



[PATCH net-next] /net/core/: fix misspellings using codespell tool

2021-03-18 Thread menglong8 . dong
From: Xiong Zhenwu 

A typo is found out by codespell tool in 1734th line of drop_monitor.c:

$ codespell ./net/core/
./net/core/drop_monitor.c:1734: guarnateed  ==> guaranteed

Fix a typo found by codespell.

Signed-off-by: Xiong Zhenwu 
---
 net/core/drop_monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 571f191c06d9..1eb02c2236f2 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -1731,7 +1731,7 @@ static void exit_net_drop_monitor(void)
 
/*
 * Because of the module_get/put we do in the trace state change path
-* we are guarnateed not to have any current users when we get here
+* we are guaranteed not to have any current users when we get here
 */
 
for_each_possible_cpu(cpu) {
-- 
2.25.1



[PATCH net-next] /net/hsr: fix misspellings using codespell tool

2021-03-18 Thread menglong8 . dong
From: Xiong Zhenwu 

A typo is found out by codespell tool in 111th line of hsr_debugfs.c:

$ codespell ./net/hsr/

net/hsr/hsr_debugfs.c:111: Debufs  ==> Debugfs

Fix typos found by codespell.

Signed-off-by: Xiong Zhenwu 
---
 net/hsr/hsr_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/hsr/hsr_debugfs.c b/net/hsr/hsr_debugfs.c
index 4cfd9e829c7b..99f3af1a9d4d 100644
--- a/net/hsr/hsr_debugfs.c
+++ b/net/hsr/hsr_debugfs.c
@@ -108,7 +108,7 @@ void hsr_debugfs_init(struct hsr_priv *priv, struct 
net_device *hsr_dev)
 /* hsr_debugfs_term - Tear down debugfs intrastructure
  *
  * Description:
- * When Debufs is configured this routine removes debugfs file system
+ * When Debugfs is configured this routine removes debugfs file system
  * elements that are specific to hsr
  */
 void
-- 
2.25.1



[PATCH] fs/nilfs2: fix misspellings using codespell tool

2021-03-18 Thread menglong8 . dong
From: Liu xuzhi 

Two typos are found out by codespell tool \
in 2217th and 2254th lines of segment.c:

$ codespell ./fs/nilfs2/
./segment.c:2217 :retured  ==> returned
./segment.c:2254: retured  ==> returned

Fix two typos found by codespell.

Signed-off-by: Liu xuzhi 
---
 fs/nilfs2/segment.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index cd4da9535aed..686c8ee7b29c 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2214,7 +2214,7 @@ static void nilfs_segctor_wakeup(struct nilfs_sc_info 
*sci, int err)
  * nilfs_construct_segment - construct a logical segment
  * @sb: super block
  *
- * Return Value: On success, 0 is retured. On errors, one of the following
+ * Return Value: On success, 0 is returned. On errors, one of the following
  * negative error code is returned.
  *
  * %-EROFS - Read only filesystem.
@@ -2251,7 +2251,7 @@ int nilfs_construct_segment(struct super_block *sb)
  * @start: start byte offset
  * @end: end byte offset (inclusive)
  *
- * Return Value: On success, 0 is retured. On errors, one of the following
+ * Return Value: On success, 0 is returned. On errors, one of the following
  * negative error code is returned.
  *
  * %-EROFS - Read only filesystem.
-- 
2.25.1



[PATCH] /fs/overlayfs/: fix misspellings using codespell tool

2021-03-18 Thread menglong8 . dong
From: Xiong Zhenwu 

A typo is found out by codespell tool:

$ codespell ./fs/overlayfs/
./fs/overlayfs/util.c:217: dependig  ==> depending

Fix a typo found by codespell.

Signed-off-by: Xiong Zhenwu 
---
 fs/overlayfs/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 7f5a01a11f97..2544694d40b9 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -214,7 +214,7 @@ const struct ovl_layer *ovl_layer_lower(struct dentry 
*dentry)
 
 /*
  * ovl_dentry_lower() could return either a data dentry or metacopy dentry
- * dependig on what is stored in lowerstack[0]. At times we need to find
+ * depending on what is stored in lowerstack[0]. At times we need to find
  * lower dentry which has data (and not metacopy dentry). This helper
  * returns the lower data dentry.
  */
-- 
2.25.1



[PATCH] security/smack: fix misspellings using codespell tool

2021-03-18 Thread menglong8 . dong
From: Xiong Zhenwu 

A typo is found out by codespell tool in 116th line of smackfs.c:

$ codespell ./security/smack
./smackfs.c:116: lables  ==> labels

Fix a typo found by codespell.

Signed-off-by: Xiong Zhenwu 
---
 security/smack/smackfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 22ded2c26089..ef8625cb3f2a 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -113,7 +113,7 @@ struct smack_known *smack_syslog_label;
  * SMACK_PTRACE_DEFAULTregular smack ptrace rules (/proc based)
  * SMACK_PTRACE_EXACT  labels must match, but can be overriden with
  *CAP_SYS_PTRACE
- * SMACK_PTRACE_DRACONIAN  lables must match, CAP_SYS_PTRACE has no effect
+ * SMACK_PTRACE_DRACONIAN  labels must match, CAP_SYS_PTRACE has no effect
  */
 int smack_ptrace_rule = SMACK_PTRACE_DEFAULT;
 
-- 
2.25.1



[PATCH] security/smack/: fix misspellings using codespell tool

2021-03-18 Thread menglong8 . dong
From: Xiong Zhenwu 

A typo is found out by codespell tool in 383th line of smackfs.c:

$ codespell ./security/smack/
./smackfs.c:383: numer  ==> number

Fix a typo found by codespell.

Signed-off-by: Xiong Zhenwu 
---
 security/smack/smackfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 22ded2c26089..66f3c539d504 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -380,7 +380,7 @@ static int smk_parse_rule(const char *data, struct 
smack_parsed_rule *rule,
  * @data: string to be parsed, null terminated
  * @rule: Will be filled with Smack parsed rule
  * @import: if non-zero, import labels
- * @tokens: numer of substrings expected in data
+ * @tokens: number of substrings expected in data
  *
  * Returns number of processed bytes on success, -ERRNO on failure.
  */
-- 
2.25.1



[PATCH] selftests: remove duplicate include

2021-03-16 Thread menglong8 . dong
From: Zhang Yunkai 

'assert.h' included in 'sparsebit.c' is duplicated.
It is also included in the 161th line.
'string.h' included in 'mincore_selftest.c' is duplicated.
It is also included in the 15th line.
'sched.h' included in 'tlbie_test.c' is duplicated.
It is also included in the 33th line.

Signed-off-by: Zhang Yunkai 
---
 tools/testing/selftests/kvm/lib/sparsebit.c| 1 -
 tools/testing/selftests/mincore/mincore_selftest.c | 1 -
 tools/testing/selftests/powerpc/mm/tlbie_test.c| 1 -
 3 files changed, 3 deletions(-)

diff --git a/tools/testing/selftests/kvm/lib/sparsebit.c 
b/tools/testing/selftests/kvm/lib/sparsebit.c
index 031ba3c932ed..a0d0c83d83de 100644
--- a/tools/testing/selftests/kvm/lib/sparsebit.c
+++ b/tools/testing/selftests/kvm/lib/sparsebit.c
@@ -1890,7 +1890,6 @@ void sparsebit_validate_internal(struct sparsebit *s)
  */
 
 #include 
-#include 
 
 struct range {
sparsebit_idx_t first, last;
diff --git a/tools/testing/selftests/mincore/mincore_selftest.c 
b/tools/testing/selftests/mincore/mincore_selftest.c
index 5a1e85ff5d32..e54106643337 100644
--- a/tools/testing/selftests/mincore/mincore_selftest.c
+++ b/tools/testing/selftests/mincore/mincore_selftest.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "../kselftest.h"
 #include "../kselftest_harness.h"
diff --git a/tools/testing/selftests/powerpc/mm/tlbie_test.c 
b/tools/testing/selftests/powerpc/mm/tlbie_test.c
index f85a0938ab25..48344a74b212 100644
--- a/tools/testing/selftests/powerpc/mm/tlbie_test.c
+++ b/tools/testing/selftests/powerpc/mm/tlbie_test.c
@@ -33,7 +33,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.25.1



[PATCH] lightnvm: remove duplicate include in lightnvm.h

2021-03-13 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/ioctl.h' included in 'lightnvm.h' is duplicated.
It is also included in the 33th line.

Signed-off-by: Zhang Yunkai 
---
 include/uapi/linux/lightnvm.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/uapi/linux/lightnvm.h b/include/uapi/linux/lightnvm.h
index ead2e72e5c88..2745afd9b8fa 100644
--- a/include/uapi/linux/lightnvm.h
+++ b/include/uapi/linux/lightnvm.h
@@ -22,7 +22,6 @@
 
 #ifdef __KERNEL__
 #include 
-#include 
 #else /* __KERNEL__ */
 #include 
 #include 
-- 
2.25.1



[PATCH] signal: remove duplicate include in signal.h

2021-03-13 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/string.h' included in 'signal.h' is duplicated.
It is also included in the 7th line.

Signed-off-by: Zhang Yunkai 
---
 include/linux/signal.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/signal.h b/include/linux/signal.h
index 205526c4003a..c371d3a3ff61 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -124,7 +124,6 @@ static inline int sigequalsets(const sigset_t *set1, const 
sigset_t *set2)
 #define sigmask(sig)   (1UL << ((sig) - 1))
 
 #ifndef __HAVE_ARCH_SIG_SETOPS
-#include 
 
 #define _SIG_SET_BINOP(name, op)   \
 static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \
-- 
2.25.1



[PATCH] mtd:rawnand: remove duplicate include in rawnand.h

2021-03-13 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/mtd/nand.h' included in 'rawnand.h' is duplicated.
It is also included in the 17th line.

Signed-off-by: Zhang Yunkai 
---
 include/linux/mtd/rawnand.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 6b3240e44310..93e8f72beba6 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.25.1



[PATCH] lightnvm: remove duplicate include in lightnvm.h

2021-03-13 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/blkdev.h' and 'uapi/linux/lightnvm.h' included in 'lightnvm.h'
is duplicated.It is also included in the 5th and 7th line.

Signed-off-by: Zhang Yunkai 
---
 include/linux/lightnvm.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h
index 1db223710b28..0908abda9c1b 100644
--- a/include/linux/lightnvm.h
+++ b/include/linux/lightnvm.h
@@ -112,10 +112,8 @@ struct nvm_dev_ops {
 
 #ifdef CONFIG_NVM
 
-#include 
 #include 
 #include 
-#include 
 
 enum {
/* HW Responsibilities */
-- 
2.25.1



[PATCH] crash_dump: remove duplicate include in crash_dump.h

2021-03-13 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/pgtable.h' included in 'crash_dump.h' is duplicated.
It is also included in the 8th line.

Signed-off-by: Zhang Yunkai 
---
 include/linux/crash_dump.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index a5192b718dbe..6bd8a33cb740 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -8,8 +8,6 @@
 #include 
 #include 
 
-#include  /* for pgprot_t */
-
 #ifdef CONFIG_CRASH_DUMP
 #define ELFCORE_ADDR_MAX   (-1ULL)
 #define ELFCORE_ADDR_ERR   (-2ULL)
-- 
2.25.1



[PATCH] ARM:sa1100: remove duplicate include in hackkit.c

2021-03-13 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/tty.h' included in 'hackkit.c' is duplicated.
It is also included in the 13th line.

Signed-off-by: Zhang Yunkai 
---
 arch/arm/mach-sa1100/hackkit.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index 3085f1c2e586..3fe34ee7c0ab 100644
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.25.1



[PATCH] kernel/bpf/: fix misspellings using codespell tool

2021-03-11 Thread menglong8 . dong
From: Liu xuzhi 

A typo is found out by codespell tool in 34th lines of hashtab.c:

$ codespell ./kernel/bpf/
./hashtab.c:34 : differrent ==> different

Fix a typo found by codespell.

Signed-off-by: Liu xuzhi 
---
 kernel/bpf/hashtab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
index d63912e73ad9..46f076c0b3a2 100644
--- a/kernel/bpf/hashtab.c
+++ b/kernel/bpf/hashtab.c
@@ -31,7 +31,7 @@
 /*
  * The bucket lock has two protection scopes:
  *
- * 1) Serializing concurrent operations from BPF programs on differrent
+ * 1) Serializing concurrent operations from BPF programs on different
  *CPUs
  *
  * 2) Serializing concurrent operations from BPF programs and sys_bpf()
-- 
2.25.1



[PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-09 Thread menglong8 . dong
From: Menglong Dong 

The bit mask for MSG_* seems a little confused here. Replace it
with BIT() to make it clear to understand.

Signed-off-by: Menglong Dong 
---
v4:
- CC netdev
v3:
- move changelog here
v2:
- use BIT() instead of BIT_MASK()
---
 include/linux/socket.h | 71 ++
 1 file changed, 37 insertions(+), 34 deletions(-)

diff --git a/include/linux/socket.h b/include/linux/socket.h
index 385894b4a8bb..e88859f38cd0 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -283,42 +283,45 @@ struct ucred {
Added those for 1003.1g not all are supported yet
  */
 
-#define MSG_OOB1
-#define MSG_PEEK   2
-#define MSG_DONTROUTE  4
-#define MSG_TRYHARD 4   /* Synonym for MSG_DONTROUTE for DECnet */
-#define MSG_CTRUNC 8
-#define MSG_PROBE  0x10/* Do not send. Only probe path f.e. for MTU */
-#define MSG_TRUNC  0x20
-#define MSG_DONTWAIT   0x40/* Nonblocking io*/
-#define MSG_EOR 0x80   /* End of record */
-#define MSG_WAITALL0x100   /* Wait for a full request */
-#define MSG_FIN 0x200
-#define MSG_SYN0x400
-#define MSG_CONFIRM0x800   /* Confirm path validity */
-#define MSG_RST0x1000
-#define MSG_ERRQUEUE   0x2000  /* Fetch message from error queue */
-#define MSG_NOSIGNAL   0x4000  /* Do not generate SIGPIPE */
-#define MSG_MORE   0x8000  /* Sender will send more */
-#define MSG_WAITFORONE 0x1 /* recvmmsg(): block until 1+ packets avail */
-#define MSG_SENDPAGE_NOPOLICY 0x1 /* sendpage() internal : do no apply 
policy */
-#define MSG_SENDPAGE_NOTLAST 0x2 /* sendpage() internal : not the last 
page */
-#define MSG_BATCH  0x4 /* sendmmsg(): more messages coming */
-#define MSG_EOF MSG_FIN
-#define MSG_NO_SHARED_FRAGS 0x8 /* sendpage() internal : page frags are 
not shared */
-#define MSG_SENDPAGE_DECRYPTED 0x10 /* sendpage() internal : page may carry
- * plain text and require encryption
- */
-
-#define MSG_ZEROCOPY   0x400   /* Use user data in kernel path */
-#define MSG_FASTOPEN   0x2000  /* Send data in TCP SYN */
-#define MSG_CMSG_CLOEXEC 0x4000/* Set close_on_exec for file
-  descriptor received through
-  SCM_RIGHTS */
+#define MSG_OOBBIT(0)
+#define MSG_PEEK   BIT(1)
+#define MSG_DONTROUTE  BIT(2)
+#define MSG_TRYHARDBIT(2)  /* Synonym for MSG_DONTROUTE for DECnet 
*/
+#define MSG_CTRUNC BIT(3)
+#define MSG_PROBE  BIT(4)  /* Do not send. Only probe path f.e. for MTU
*/
+#define MSG_TRUNC  BIT(5)
+#define MSG_DONTWAIT   BIT(6)  /* Nonblocking io   */
+#define MSG_EORBIT(7)  /* End of record*/
+#define MSG_WAITALLBIT(8)  /* Wait for a full request  */
+#define MSG_FINBIT(9)
+#define MSG_SYNBIT(10)
+#define MSG_CONFIRMBIT(11) /* Confirm path validity*/
+#define MSG_RSTBIT(12)
+#define MSG_ERRQUEUE   BIT(13) /* Fetch message from error queue */
+#define MSG_NOSIGNAL   BIT(14) /* Do not generate SIGPIPE  */
+#define MSG_MORE   BIT(15) /* Sender will send more*/
+#define MSG_WAITFORONE BIT(16) /* recvmmsg(): block until 1+ packets avail */
+#define MSG_SENDPAGE_NOPOLICY  BIT(16) /* sendpage() internal : do no apply 
policy */
+#define MSG_SENDPAGE_NOTLAST   BIT(17) /* sendpage() internal : not the last 
page  */
+#define MSG_BATCH  BIT(18) /* sendmmsg(): more messages coming */
+#define MSG_EOFMSG_FIN
+#define MSG_NO_SHARED_FRAGSBIT(19) /* sendpage() internal : page frags
+* are not shared
+*/
+#define MSG_SENDPAGE_DECRYPTED BIT(20) /* sendpage() internal : page may carry
+* plain text and require encryption
+*/
+
+#define MSG_ZEROCOPY   BIT(26) /* Use user data in kernel path */
+#define MSG_FASTOPEN   BIT(29) /* Send data in TCP SYN */
+#define MSG_CMSG_CLOEXEC   BIT(30) /* Set close_on_exec for file
+* descriptor received through
+* SCM_RIGHTS
+*/
 #if defined(CONFIG_COMPAT)
-#define MSG_CMSG_COMPAT0x8000  /* This message needs 32 bit 
fixups */
+#define MSG_CMSG_COMPATBIT(31) /* This message needs 32 bit fixups */
 #else
-#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
+#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups */
 #endif
 
 
-- 
2.25.1



[PATCH net-next] net: netlink: remove netlink_broadcast_filtered

2021-03-09 Thread menglong8 . dong
From: Menglong Dong 

It seems that 'netlink_broadcast_filtered()' is not used anywhere
besides 'netlink_broadcast()'. In order to reduce function calls,
just remove it.

Signed-off-by: Menglong Dong 
---
 include/linux/netlink.h  |  4 
 net/netlink/af_netlink.c | 22 ++
 2 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 0bcf98098c5a..277f33e64bb3 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -160,10 +160,6 @@ bool netlink_strict_get_check(struct sk_buff *skb);
 int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int 
nonblock);
 int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid,
  __u32 group, gfp_t allocation);
-int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
-  __u32 portid, __u32 group, gfp_t allocation,
-  int (*filter)(struct sock *dsk, struct sk_buff 
*skb, void *data),
-  void *filter_data);
 int netlink_set_err(struct sock *ssk, __u32 portid, __u32 group, int code);
 int netlink_register_notifier(struct notifier_block *nb);
 int netlink_unregister_notifier(struct notifier_block *nb);
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index dd488938447f..b462fdc87e9b 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1405,8 +1405,6 @@ struct netlink_broadcast_data {
int delivered;
gfp_t allocation;
struct sk_buff *skb, *skb2;
-   int (*tx_filter)(struct sock *dsk, struct sk_buff *skb, void *data);
-   void *tx_data;
 };
 
 static void do_one_broadcast(struct sock *sk,
@@ -1460,11 +1458,6 @@ static void do_one_broadcast(struct sock *sk,
p->delivery_failure = 1;
goto out;
}
-   if (p->tx_filter && p->tx_filter(sk, p->skb2, p->tx_data)) {
-   kfree_skb(p->skb2);
-   p->skb2 = NULL;
-   goto out;
-   }
if (sk_filter(sk, p->skb2)) {
kfree_skb(p->skb2);
p->skb2 = NULL;
@@ -1487,10 +1480,8 @@ static void do_one_broadcast(struct sock *sk,
sock_put(sk);
 }
 
-int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, u32 
portid,
-   u32 group, gfp_t allocation,
-   int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data),
-   void *filter_data)
+int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 portid,
+ u32 group, gfp_t allocation)
 {
struct net *net = sock_net(ssk);
struct netlink_broadcast_data info;
@@ -1509,8 +1500,6 @@ int netlink_broadcast_filtered(struct sock *ssk, struct 
sk_buff *skb, u32 portid
info.allocation = allocation;
info.skb = skb;
info.skb2 = NULL;
-   info.tx_filter = filter;
-   info.tx_data = filter_data;
 
/* While we sleep in clone, do not allow to change socket list */
 
@@ -1536,14 +1525,7 @@ int netlink_broadcast_filtered(struct sock *ssk, struct 
sk_buff *skb, u32 portid
}
return -ESRCH;
 }
-EXPORT_SYMBOL(netlink_broadcast_filtered);
 
-int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 portid,
- u32 group, gfp_t allocation)
-{
-   return netlink_broadcast_filtered(ssk, skb, portid, group, allocation,
-   NULL, NULL);
-}
 EXPORT_SYMBOL(netlink_broadcast);
 
 struct netlink_set_err_data {
-- 
2.30.1



[PATCH] security/apparmor: fix misspellings using codespell tool

2021-03-08 Thread menglong8 . dong
From: Xiong Zhenwu 

A typo is found out by codespell tool in 204th line of apparmorfs.c:

$ codespell ./security/apparmor/
./apparmorfs.c:204: seting  ==> setting

Fix a typo found by codespell.

Signed-off-by: Xiong Zhenwu 
---
 security/apparmor/apparmorfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 2ee3b3d29f10..79591fc131b0 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -201,7 +201,7 @@ static struct file_system_type aafs_ops = {
 /**
  * __aafs_setup_d_inode - basic inode setup for apparmorfs
  * @dir: parent directory for the dentry
- * @dentry: dentry we are seting the inode up for
+ * @dentry: dentry we are setting the inode up for
  * @mode: permissions the file should have
  * @data: data to store on inode.i_private, available in open()
  * @link: if symlink, symlink target string
-- 
2.25.1



[PATCH] security/selinux/include/: fix misspellings using codespell tool

2021-03-08 Thread menglong8 . dong
From: Xiong Zhenwu 

A typo is f out by codespell tool in 422th line of security.h:

$ codespell ./security/selinux/include/ 
./security.h:422: thie  ==> the, this

Fix a typo found by codespell.

Signed-off-by: Xiong Zhenwu 
---
 security/selinux/include/security.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/selinux/include/security.h 
b/security/selinux/include/security.h
index 6fe25300b89d..7130c9648ad1 100644
--- a/security/selinux/include/security.h
+++ b/security/selinux/include/security.h
@@ -419,7 +419,7 @@ extern struct page *selinux_kernel_status_page(struct 
selinux_state *state);
 
 #define SELINUX_KERNEL_STATUS_VERSION  1
 struct selinux_kernel_status {
-   u32 version;/* version number of thie structure */
+   u32 version;/* version number of the structure */
u32 sequence;   /* sequence number of seqlock logic */
u32 enforcing;  /* current setting of enforcing mode */
u32 policyload; /* times of policy reloaded */
-- 
2.25.1



[PATCH] security/selinux/ss: fix misspellings using codespell tool

2021-03-08 Thread menglong8 . dong
From: Xiong Zhenwu 

A typo is found out by codespell tool in 16th line of hashtab.c

$ codespell ./security/selinux/ss/
./hashtab.c:16: rouding  ==> rounding

Fix a typo found by codespell.

Signed-off-by: Xiong Zhenwu 
---
 security/selinux/ss/hashtab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/selinux/ss/hashtab.c b/security/selinux/ss/hashtab.c
index 3881787ce492..b8f6b3e0a921 100644
--- a/security/selinux/ss/hashtab.c
+++ b/security/selinux/ss/hashtab.c
@@ -13,7 +13,7 @@ static struct kmem_cache *hashtab_node_cachep __ro_after_init;
 
 /*
  * Here we simply round the number of elements up to the nearest power of two.
- * I tried also other options like rouding down or rounding to the closest
+ * I tried also other options like rounding down or rounding to the closest
  * power of two (up or down based on which is closer), but I was unable to
  * find any significant difference in lookup/insert performance that would
  * justify switching to a different (less intuitive) formula. It could be that
-- 
2.25.1



[PATCH] mm:process_vm_access: remove duplicate include

2021-03-06 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/compat.h' included in 'process_vm_access.c' is duplicated.

Signed-off-by: Zhang Yunkai 
---
 mm/process_vm_access.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c
index f5fee9cf90f8..4bcc11958089 100644
--- a/mm/process_vm_access.c
+++ b/mm/process_vm_access.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.25.1



[PATCH] watchdog:dw_wdt: remove duplicate include

2021-03-06 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/kernel.h' included in 'dw_wdt.c' is duplicated.
It is also included in the 17th line.

Signed-off-by: Zhang Yunkai 
---
 drivers/watchdog/dw_wdt.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index 32d0e1781e63..b1642e2d9175 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -19,7 +19,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.25.1



[PATCH] thermal:ti-soc-thermal: remove duplicate include in ti-bandgap

2021-03-06 Thread menglong8 . dong
From: Zhang Yunkai 

'of_device.h' included in 'ti-bandgap.c' is duplicated.
It is also included in the 25th line.

Signed-off-by: Zhang Yunkai 
---
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c 
b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
index 8a3646e26ddd..d81af89166d2 100644
--- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
+++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "ti-bandgap.h"
 
-- 
2.25.1



[PATCH] media:atomisp: remove duplicate include in sh_css

2021-03-06 Thread menglong8 . dong
From: Zhang Yunkai 

'ia_css_isys.h' included in 'sh_css.c' is duplicated.
It is also included in the 30th line.

Signed-off-by: Zhang Yunkai 
---
 drivers/staging/media/atomisp/pci/sh_css.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/sh_css.c 
b/drivers/staging/media/atomisp/pci/sh_css.c
index ddee04c8248d..afddc54094e9 100644
--- a/drivers/staging/media/atomisp/pci/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/sh_css.c
@@ -49,9 +49,6 @@
 #include "ia_css_pipe_util.h"
 #include "ia_css_pipe_binarydesc.h"
 #include "ia_css_pipe_stagedesc.h"
-#ifndef ISP2401
-#include "ia_css_isys.h"
-#endif
 
 #include "tag.h"
 #include "assert_support.h"
-- 
2.25.1



[PATCH] soc:litex: remove duplicate include in litex_soc_ctrl

2021-03-06 Thread menglong8 . dong
From: Zhang Yunkai 

'errno.h' included in 'litex_soc_ctrl.c' is duplicated.
It is also included in the 11th line.

Signed-off-by: Zhang Yunkai 
---
 drivers/soc/litex/litex_soc_ctrl.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/soc/litex/litex_soc_ctrl.c 
b/drivers/soc/litex/litex_soc_ctrl.c
index 6268bfa7f0d6..c3e379a990f2 100644
--- a/drivers/soc/litex/litex_soc_ctrl.c
+++ b/drivers/soc/litex/litex_soc_ctrl.c
@@ -13,7 +13,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
-- 
2.25.1



[PATCH] scsi:ufs: remove duplicate include in ufshcd

2021-03-06 Thread menglong8 . dong
From: Zhang Yunkai 

'blkdev.h' included in 'ufshcd.c' is duplicated.
It is also included in the 18th line.

Signed-off-by: Zhang Yunkai 
---
 drivers/scsi/ufs/ufshcd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 77161750c9fb..9a564b6fd092 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -24,7 +24,6 @@
 #include "ufs_bsg.h"
 #include "ufshcd-crypto.h"
 #include 
-#include 
 
 #define CREATE_TRACE_POINTS
 #include 
-- 
2.25.1



[PATCH] media:vidtv: remove duplicate include in vidtv_psi

2021-03-06 Thread menglong8 . dong
From: Zhang Yunkai 

'string.h' included in 'vidtv_psi.c' is duplicated.

Signed-off-by: Zhang Yunkai 
---
 drivers/media/test-drivers/vidtv/vidtv_psi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/test-drivers/vidtv/vidtv_psi.c 
b/drivers/media/test-drivers/vidtv/vidtv_psi.c
index 47ed7907db8d..c11ac8dca73d 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_psi.c
+++ b/drivers/media/test-drivers/vidtv/vidtv_psi.c
@@ -19,7 +19,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
-- 
2.25.1



[PATCH] drm/nouveau: remove duplicate include in nouveau_dmem and base

2021-03-06 Thread menglong8 . dong
From: Zhang Yunkai 

'if000c.h' included in 'nouveau_dmem.c' is duplicated.
'priv.h' included in 'base.c' is duplicated.

Signed-off-by: Zhang Yunkai 
---
 drivers/gpu/drm/nouveau/nouveau_dmem.c   | 1 -
 drivers/gpu/drm/nouveau/nvkm/engine/nvenc/base.c | 2 --
 2 files changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c 
b/drivers/gpu/drm/nouveau/nouveau_dmem.c
index 92987daa5e17..f5cc057b123b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
@@ -33,7 +33,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/nvenc/base.c 
b/drivers/gpu/drm/nouveau/nvkm/engine/nvenc/base.c
index c39e797dc7c9..09524168431c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/nvenc/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/nvenc/base.c
@@ -20,8 +20,6 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 #include "priv.h"
-
-#include "priv.h"
 #include 
 
 static void *
-- 
2.25.1



[PATCH] drm/amd/display: remove duplicate include in dcn21 and gpio

2021-03-06 Thread menglong8 . dong
From: Zhang Yunkai 

'dce110_resource.h' included in 'dcn21_resource.c' is duplicated.
'hw_gpio.h' included in 'hw_factory_dce110.c' is duplicated.

Signed-off-by: Zhang Yunkai 
---
 drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 1 -
 .../gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c| 4 
 2 files changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c 
b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
index 072f8c880924..8a6a965751e8 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
@@ -61,7 +61,6 @@
 #include "dcn21/dcn21_dccg.h"
 #include "dcn21_hubbub.h"
 #include "dcn10/dcn10_resource.h"
-#include "dce110/dce110_resource.h"
 #include "dce/dce_panel_cntl.h"
 
 #include "dcn20/dcn20_dwb.h"
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c 
b/drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c
index 66e4841f41e4..ca335ea60412 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c
@@ -48,10 +48,6 @@
 #define REGI(reg_name, block, id)\
mm ## block ## id ## _ ## reg_name
 
-#include "../hw_gpio.h"
-#include "../hw_ddc.h"
-#include "../hw_hpd.h"
-
 #include "reg_helper.h"
 #include "../hpd_regs.h"
 
-- 
2.25.1



[PATCH] drm/amd/display: remove duplicate include in amdgpu_dm.c

2021-03-06 Thread menglong8 . dong
From: Zhang Yunkai 

'drm/drm_hdcp.h' included in 'amdgpu_dm.c' is duplicated.
It is also included in the 79th line.

Signed-off-by: Zhang Yunkai 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 3e1fd1e7d09f..fee46fbcb0b7 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -44,7 +44,6 @@
 #include "amdgpu_dm.h"
 #ifdef CONFIG_DRM_AMD_DC_HDCP
 #include "amdgpu_dm_hdcp.h"
-#include 
 #endif
 #include "amdgpu_pm.h"
 
-- 
2.25.1



[PATCH] bus:bt1-apb: remove duplicate include in bt1-apb.c

2021-03-06 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/clk.h' included in 'bt1-apb.c' is duplicated.

Signed-off-by: Zhang Yunkai 
---
 drivers/bus/bt1-apb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/bus/bt1-apb.c b/drivers/bus/bt1-apb.c
index b25ff941e7c7..74b1b712ef3a 100644
--- a/drivers/bus/bt1-apb.c
+++ b/drivers/bus/bt1-apb.c
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #define APB_EHB_ISR0x00
-- 
2.25.1



[PATCH] x86/traps: remove duplicate include in traps.c

2021-03-05 Thread menglong8 . dong
From: Zhang Yunkai 

'proto.h' included in 'traps.c' is duplicated.

Signed-off-by: Zhang Yunkai 
---
 arch/x86/kernel/traps.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 7f5aec758f0e..cb9b675dc003 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -61,14 +61,13 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef CONFIG_X86_64
 #include 
-#include 
 #else
 #include 
 #include 
-#include 
 #endif
 
 DECLARE_BITMAP(system_vectors, NR_VECTORS);
-- 
2.25.1



[PATCH] x86/smpboot: remove duplicate include in smpboot.c

2021-03-05 Thread menglong8 . dong
From: Zhang Yunkai 

'cpu_device_id.h' and 'intel_family.h' included in 'smpboot.c'
is duplicated. It is also included in the 80th line.

Signed-off-by: Zhang Yunkai 
---
 arch/x86/kernel/smpboot.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 02813a7f3a7c..ec4bf691fe28 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1865,9 +1865,6 @@ static bool slv_set_max_freq_ratio(u64 *base_freq, u64 
*turbo_freq)
return true;
 }
 
-#include 
-#include 
-
 #define X86_MATCH(model)   \
X86_MATCH_VENDOR_FAM_MODEL_FEATURE(INTEL, 6,\
INTEL_FAM6_##model, X86_FEATURE_APERFMPERF, NULL)
-- 
2.25.1



[PATCH] tool/perf/bench: fix misspellings using codespell

2021-03-05 Thread menglong8 . dong
From: Xiong Zhenwu 

$ codespell ./tool/perf/bench
tools/perf/bench/inject-buildid.c:375: tihs  ==> this 

Fix a typo found by codespell.

Signed-off-by: Xiong Zhenwu 
---
 tools/perf/bench/inject-buildid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/bench/inject-buildid.c 
b/tools/perf/bench/inject-buildid.c
index 280227e3ffd7..55d373b75791 100644
--- a/tools/perf/bench/inject-buildid.c
+++ b/tools/perf/bench/inject-buildid.c
@@ -372,7 +372,7 @@ static int inject_build_id(struct bench_data *data, u64 
*max_rss)
len += synthesize_flush(data);
}
 
-   /* tihs makes the child to finish */
+   /* this makes the child to finish */
close(data->input_pipe[1]);
 
wait4(data->pid, , 0, );
-- 
2.25.1



[PATCH] sh: remove duplicate include in tlb.h

2021-03-04 Thread menglong8 . dong
From: Zhang Yunkai 

'asm-generic/tlb.h' included in 'asm/tlb.h' is duplicated.

Signed-off-by: Zhang Yunkai 
---
 arch/sh/include/asm/tlb.h | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/sh/include/asm/tlb.h b/arch/sh/include/asm/tlb.h
index 360f713d009b..aeb8915e9254 100644
--- a/arch/sh/include/asm/tlb.h
+++ b/arch/sh/include/asm/tlb.h
@@ -4,12 +4,11 @@
 
 #ifndef __ASSEMBLY__
 #include 
+#include 
 
 #ifdef CONFIG_MMU
 #include 
 
-#include 
-
 #if defined(CONFIG_CPU_SH4)
 extern void tlb_wire_entry(struct vm_area_struct *, unsigned long, pte_t);
 extern void tlb_unwire_entry(void);
@@ -24,12 +23,7 @@ static inline void tlb_unwire_entry(void)
 {
BUG();
 }
-#endif
-
-#else /* CONFIG_MMU */
-
-#include 
-
+#endif /* CONFIG_CPU_SH4 */
 #endif /* CONFIG_MMU */
 #endif /* __ASSEMBLY__ */
 #endif /* __ASM_SH_TLB_H */
-- 
2.25.1



[PATCH] kernel/sched: remove duplicate include in sched.h sched.h

2021-03-04 Thread menglong8 . dong
From: Xiong Zhenwu 

'linux/psi.h' included in 'kernel/sched/sched.h' is duplicated. it also
include in 59th line.

Signed-off-by: Xiong Zhenwu 
---
 kernel/sched/sched.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 10a1522b1e30..235d8381f142 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -344,7 +344,6 @@ extern bool dl_cpu_busy(unsigned int cpu);
 #ifdef CONFIG_CGROUP_SCHED
 
 #include 
-#include 
 
 struct cfs_rq;
 struct rt_rq;
-- 
2.25.1



[PATCH] arch:powerpc:kernel: remove duplicate include in traps.c

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

'asm/tm.h' included in 'traps.c' is duplicated.
It is also included in the 62th line.

Signed-off-by: Zhang Yunkai 
---
 arch/powerpc/kernel/traps.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 1583fd1c6010..dcdb93588828 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -53,7 +53,6 @@
 #ifdef CONFIG_PPC64
 #include 
 #include 
-#include 
 #endif
 #include 
 #include 
-- 
2.25.1



[PATCH] arch:powerpc:kernel: remove duplicate include in setup-common

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

'asm/udbg.h' included in 'setup-common.c' is duplicated.
It is also included in the 61th line.

Signed-off-by: Zhang Yunkai 
---
 arch/powerpc/kernel/setup-common.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/kernel/setup-common.c 
b/arch/powerpc/kernel/setup-common.c
index bee984b1887b..7221f11acf04 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -69,7 +69,6 @@
 #include "setup.h"
 
 #ifdef DEBUG
-#include 
 #define DBG(fmt...) udbg_printf(fmt)
 #else
 #define DBG(fmt...)
-- 
2.25.1



[PATCH] arch/powerpc/include: remove duplicate include in thread_info.h

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

'asm/page.h' included in 'arch/powerpc/include/asm/thread_info.h'
is duplicated.It is also included in 13th line.

Signed-off-by: Zhang Yunkai 
---
 arch/powerpc/include/asm/thread_info.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/include/asm/thread_info.h 
b/arch/powerpc/include/asm/thread_info.h
index 386d576673a1..9d6402402b9b 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -38,7 +38,6 @@
 #ifndef __ASSEMBLY__
 #include 
 #include 
-#include 
 #include 
 
 #define SLB_PRELOAD_NR 16U
-- 
2.25.1



[PATCH] arch/powerpc/include: remove duplicate include in pgtable.h

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

'asm/tlbflush.h' included in 'arch/powerpc/include/asm/pgtable.h'
is duplicated.It is also included in the 11th line.

Signed-off-by: Zhang Yunkai 
---
 arch/powerpc/include/asm/pgtable.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/powerpc/include/asm/pgtable.h 
b/arch/powerpc/include/asm/pgtable.h
index 4eed82172e33..c6a676714f04 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -41,8 +41,6 @@ struct mm_struct;
 
 #ifndef __ASSEMBLY__
 
-#include 
-
 /* Keep these as a macros to avoid include dependency mess */
 #define pte_page(x)pfn_to_page(pte_pfn(x))
 #define mk_pte(page, pgprot)   pfn_pte(page_to_pfn(page), (pgprot))
-- 
2.25.1



[PATCH] arch/powerpc/include:fix misspellings in tlbflush.h

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

Some typos are found out.The information at the end of the file
does not match the beginning.

Signed-off-by: Zhang Yunkai 
---
 arch/powerpc/include/asm/book3s/32/tlbflush.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/book3s/32/tlbflush.h 
b/arch/powerpc/include/asm/book3s/32/tlbflush.h
index d941c06d4f2e..ba1743c52b56 100644
--- a/arch/powerpc/include/asm/book3s/32/tlbflush.h
+++ b/arch/powerpc/include/asm/book3s/32/tlbflush.h
@@ -79,4 +79,4 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm)
flush_tlb_mm(mm);
 }
 
-#endif /* _ASM_POWERPC_TLBFLUSH_H */
+#endif /* _ASM_POWERPC_BOOK3S_32_TLBFLUSH_H */
-- 
2.25.1



[PATCH] arch/powerpc/include/asm/book3s/64/: remove duplicate include in mmu-hash.h

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

'asm/bug.h' included in 'arch/powerpc/include/asm/book3s/64/mmu-hash.h'
is duplicated.It is also included in the 12th line.

Signed-off-by: Zhang Yunkai 
---
 arch/powerpc/include/asm/book3s/64/mmu-hash.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h 
b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
index f911bdb68d8b..3004f3323144 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
@@ -18,7 +18,6 @@
  * complete pgtable.h but only a portion of it.
  */
 #include 
-#include 
 #include 
 #include 
 
-- 
2.25.1



[PATCH] arch/parisc/kernel: remove duplicate include in ptrace

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/compat.h' included in 'arch/parisc/kernel/ptrace.c' is duplicated.
It is also included in the 24th line.

Signed-off-by: Zhang Yunkai 
---
 arch/parisc/kernel/ptrace.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index 2127974982df..918faa95740c 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -567,7 +567,6 @@ static const struct user_regset_view 
user_parisc_native_view = {
 };
 
 #ifdef CONFIG_64BIT
-#include 
 
 static int gpr32_get(struct task_struct *target,
 const struct user_regset *regset,
-- 
2.25.1



[PATCH] module: remove duplicate include in arch/ia64/kernel/head.S

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/pgtable.h' included in 'arch/ia64/kernel/head.S' is duplicated.

Signed-off-by: Zhang Yunkai 
---
 arch/ia64/kernel/head.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index 30f1ef760136..81b64d1adad5 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -33,7 +33,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #ifdef CONFIG_HOTPLUG_CPU
-- 
2.25.1



[PATCH] module: remove duplicate include in arch/csky/kernel/entry.S

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

'asm/setup.h' included in 'arch/csky/kernel/entry.S' is duplicated.

Signed-off-by: Zhang Yunkai 
---
 arch/csky/kernel/entry.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/csky/kernel/entry.S b/arch/csky/kernel/entry.S
index c1bd7a6b4ab6..00e3c8ebf9b8 100644
--- a/arch/csky/kernel/entry.S
+++ b/arch/csky/kernel/entry.S
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
-- 
2.25.1



[PATCH] module: remove duplicate include in arch/arm/mach-sa1100/hackkit.c

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/tty.h' included in 'arch/arm/mach-sa1100/hackkit.c' is duplicated.

Signed-off-by: Zhang Yunkai 
---
 arch/arm/mach-sa1100/hackkit.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index 3085f1c2e586..3fe34ee7c0ab 100644
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.25.1



[PATCH] module: remove extra spaces in include/asm-generic/tlb.h

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

Some typos are found out by codespell tool:

"# define" should be "#define".

Signed-off-by: Zhang Yunkai 
---
 include/asm-generic/tlb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 2c68a545ffa7..5be89d9ba362 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -23,7 +23,7 @@
  * the loaded mm.
  */
 #ifndef nmi_uaccess_okay
-# define nmi_uaccess_okay() true
+#define nmi_uaccess_okay() true
 #endif
 
 #ifdef CONFIG_MMU
-- 
2.25.1



[PATCH] module: remove duplicate include in ./arch/arm/include/asm/pgtable.h

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

'asm-generic/pgtable-nopud.h' included in 'pgtable.h' is duplicated.

Signed-off-by: Zhang Yunkai 
---
 arch/arm/include/asm/pgtable.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index c02f24400369..f3124e57be83 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -9,15 +9,14 @@
 
 #include 
 #include 
+#include 
 
 #ifndef CONFIG_MMU
 
-#include 
 #include 
 
 #else
 
-#include 
 #include 
 #include 
 
-- 
2.25.1



[PATCH v4 net-next] net: socket: use BIT() for MSG_*

2021-02-16 Thread menglong8 . dong
From: Menglong Dong 

The bit mask for MSG_* seems a little confused here. Replace it
with BIT() to make it clear to understand.

Signed-off-by: Menglong Dong 
---
v4:
- CC netdev
v3:
- move changelog here
v2:
- use BIT() instead of BIT_MASK()
---
 include/linux/socket.h | 71 ++
 1 file changed, 37 insertions(+), 34 deletions(-)

diff --git a/include/linux/socket.h b/include/linux/socket.h
index 385894b4a8bb..e88859f38cd0 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -283,42 +283,45 @@ struct ucred {
Added those for 1003.1g not all are supported yet
  */
 
-#define MSG_OOB1
-#define MSG_PEEK   2
-#define MSG_DONTROUTE  4
-#define MSG_TRYHARD 4   /* Synonym for MSG_DONTROUTE for DECnet */
-#define MSG_CTRUNC 8
-#define MSG_PROBE  0x10/* Do not send. Only probe path f.e. for MTU */
-#define MSG_TRUNC  0x20
-#define MSG_DONTWAIT   0x40/* Nonblocking io*/
-#define MSG_EOR 0x80   /* End of record */
-#define MSG_WAITALL0x100   /* Wait for a full request */
-#define MSG_FIN 0x200
-#define MSG_SYN0x400
-#define MSG_CONFIRM0x800   /* Confirm path validity */
-#define MSG_RST0x1000
-#define MSG_ERRQUEUE   0x2000  /* Fetch message from error queue */
-#define MSG_NOSIGNAL   0x4000  /* Do not generate SIGPIPE */
-#define MSG_MORE   0x8000  /* Sender will send more */
-#define MSG_WAITFORONE 0x1 /* recvmmsg(): block until 1+ packets avail */
-#define MSG_SENDPAGE_NOPOLICY 0x1 /* sendpage() internal : do no apply 
policy */
-#define MSG_SENDPAGE_NOTLAST 0x2 /* sendpage() internal : not the last 
page */
-#define MSG_BATCH  0x4 /* sendmmsg(): more messages coming */
-#define MSG_EOF MSG_FIN
-#define MSG_NO_SHARED_FRAGS 0x8 /* sendpage() internal : page frags are 
not shared */
-#define MSG_SENDPAGE_DECRYPTED 0x10 /* sendpage() internal : page may carry
- * plain text and require encryption
- */
-
-#define MSG_ZEROCOPY   0x400   /* Use user data in kernel path */
-#define MSG_FASTOPEN   0x2000  /* Send data in TCP SYN */
-#define MSG_CMSG_CLOEXEC 0x4000/* Set close_on_exec for file
-  descriptor received through
-  SCM_RIGHTS */
+#define MSG_OOBBIT(0)
+#define MSG_PEEK   BIT(1)
+#define MSG_DONTROUTE  BIT(2)
+#define MSG_TRYHARDBIT(2)  /* Synonym for MSG_DONTROUTE for DECnet 
*/
+#define MSG_CTRUNC BIT(3)
+#define MSG_PROBE  BIT(4)  /* Do not send. Only probe path f.e. for MTU
*/
+#define MSG_TRUNC  BIT(5)
+#define MSG_DONTWAIT   BIT(6)  /* Nonblocking io   */
+#define MSG_EORBIT(7)  /* End of record*/
+#define MSG_WAITALLBIT(8)  /* Wait for a full request  */
+#define MSG_FINBIT(9)
+#define MSG_SYNBIT(10)
+#define MSG_CONFIRMBIT(11) /* Confirm path validity*/
+#define MSG_RSTBIT(12)
+#define MSG_ERRQUEUE   BIT(13) /* Fetch message from error queue */
+#define MSG_NOSIGNAL   BIT(14) /* Do not generate SIGPIPE  */
+#define MSG_MORE   BIT(15) /* Sender will send more*/
+#define MSG_WAITFORONE BIT(16) /* recvmmsg(): block until 1+ packets avail */
+#define MSG_SENDPAGE_NOPOLICY  BIT(16) /* sendpage() internal : do no apply 
policy */
+#define MSG_SENDPAGE_NOTLAST   BIT(17) /* sendpage() internal : not the last 
page  */
+#define MSG_BATCH  BIT(18) /* sendmmsg(): more messages coming */
+#define MSG_EOFMSG_FIN
+#define MSG_NO_SHARED_FRAGSBIT(19) /* sendpage() internal : page frags
+* are not shared
+*/
+#define MSG_SENDPAGE_DECRYPTED BIT(20) /* sendpage() internal : page may carry
+* plain text and require encryption
+*/
+
+#define MSG_ZEROCOPY   BIT(26) /* Use user data in kernel path */
+#define MSG_FASTOPEN   BIT(29) /* Send data in TCP SYN */
+#define MSG_CMSG_CLOEXEC   BIT(30) /* Set close_on_exec for file
+* descriptor received through
+* SCM_RIGHTS
+*/
 #if defined(CONFIG_COMPAT)
-#define MSG_CMSG_COMPAT0x8000  /* This message needs 32 bit 
fixups */
+#define MSG_CMSG_COMPATBIT(31) /* This message needs 32 bit fixups */
 #else
-#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
+#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups */
 #endif
 
 
-- 
2.30.0



[PATCH v3 net-next] net: socket: use BIT() for MSG_*

2021-02-07 Thread menglong8 . dong
From: Menglong Dong 

The bit mask for MSG_* seems a little confused here. Replace it
with BIT() to make it clear to understand.

Signed-off-by: Menglong Dong 
---
v3:
- move changelog here
v2:
- use BIT() instead of BIT_MASK()
---
 include/linux/socket.h | 71 ++
 1 file changed, 37 insertions(+), 34 deletions(-)

diff --git a/include/linux/socket.h b/include/linux/socket.h
index 385894b4a8bb..e88859f38cd0 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -283,42 +283,45 @@ struct ucred {
Added those for 1003.1g not all are supported yet
  */
 
-#define MSG_OOB1
-#define MSG_PEEK   2
-#define MSG_DONTROUTE  4
-#define MSG_TRYHARD 4   /* Synonym for MSG_DONTROUTE for DECnet */
-#define MSG_CTRUNC 8
-#define MSG_PROBE  0x10/* Do not send. Only probe path f.e. for MTU */
-#define MSG_TRUNC  0x20
-#define MSG_DONTWAIT   0x40/* Nonblocking io*/
-#define MSG_EOR 0x80   /* End of record */
-#define MSG_WAITALL0x100   /* Wait for a full request */
-#define MSG_FIN 0x200
-#define MSG_SYN0x400
-#define MSG_CONFIRM0x800   /* Confirm path validity */
-#define MSG_RST0x1000
-#define MSG_ERRQUEUE   0x2000  /* Fetch message from error queue */
-#define MSG_NOSIGNAL   0x4000  /* Do not generate SIGPIPE */
-#define MSG_MORE   0x8000  /* Sender will send more */
-#define MSG_WAITFORONE 0x1 /* recvmmsg(): block until 1+ packets avail */
-#define MSG_SENDPAGE_NOPOLICY 0x1 /* sendpage() internal : do no apply 
policy */
-#define MSG_SENDPAGE_NOTLAST 0x2 /* sendpage() internal : not the last 
page */
-#define MSG_BATCH  0x4 /* sendmmsg(): more messages coming */
-#define MSG_EOF MSG_FIN
-#define MSG_NO_SHARED_FRAGS 0x8 /* sendpage() internal : page frags are 
not shared */
-#define MSG_SENDPAGE_DECRYPTED 0x10 /* sendpage() internal : page may carry
- * plain text and require encryption
- */
-
-#define MSG_ZEROCOPY   0x400   /* Use user data in kernel path */
-#define MSG_FASTOPEN   0x2000  /* Send data in TCP SYN */
-#define MSG_CMSG_CLOEXEC 0x4000/* Set close_on_exec for file
-  descriptor received through
-  SCM_RIGHTS */
+#define MSG_OOBBIT(0)
+#define MSG_PEEK   BIT(1)
+#define MSG_DONTROUTE  BIT(2)
+#define MSG_TRYHARDBIT(2)  /* Synonym for MSG_DONTROUTE for DECnet 
*/
+#define MSG_CTRUNC BIT(3)
+#define MSG_PROBE  BIT(4)  /* Do not send. Only probe path f.e. for MTU
*/
+#define MSG_TRUNC  BIT(5)
+#define MSG_DONTWAIT   BIT(6)  /* Nonblocking io   */
+#define MSG_EORBIT(7)  /* End of record*/
+#define MSG_WAITALLBIT(8)  /* Wait for a full request  */
+#define MSG_FINBIT(9)
+#define MSG_SYNBIT(10)
+#define MSG_CONFIRMBIT(11) /* Confirm path validity*/
+#define MSG_RSTBIT(12)
+#define MSG_ERRQUEUE   BIT(13) /* Fetch message from error queue */
+#define MSG_NOSIGNAL   BIT(14) /* Do not generate SIGPIPE  */
+#define MSG_MORE   BIT(15) /* Sender will send more*/
+#define MSG_WAITFORONE BIT(16) /* recvmmsg(): block until 1+ packets avail */
+#define MSG_SENDPAGE_NOPOLICY  BIT(16) /* sendpage() internal : do no apply 
policy */
+#define MSG_SENDPAGE_NOTLAST   BIT(17) /* sendpage() internal : not the last 
page  */
+#define MSG_BATCH  BIT(18) /* sendmmsg(): more messages coming */
+#define MSG_EOFMSG_FIN
+#define MSG_NO_SHARED_FRAGSBIT(19) /* sendpage() internal : page frags
+* are not shared
+*/
+#define MSG_SENDPAGE_DECRYPTED BIT(20) /* sendpage() internal : page may carry
+* plain text and require encryption
+*/
+
+#define MSG_ZEROCOPY   BIT(26) /* Use user data in kernel path */
+#define MSG_FASTOPEN   BIT(29) /* Send data in TCP SYN */
+#define MSG_CMSG_CLOEXEC   BIT(30) /* Set close_on_exec for file
+* descriptor received through
+* SCM_RIGHTS
+*/
 #if defined(CONFIG_COMPAT)
-#define MSG_CMSG_COMPAT0x8000  /* This message needs 32 bit 
fixups */
+#define MSG_CMSG_COMPATBIT(31) /* This message needs 32 bit fixups */
 #else
-#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
+#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups */
 #endif
 
 
-- 
2.25.1



[PATCH v2 net-next] net: socket: use BIT() for MSG_*

2021-02-06 Thread menglong8 . dong
From: Menglong Dong 

The bit mask for MSG_* seems a little confused here. Replace it
with BIT() to make it clear to understand.

Changes since v1:
- use BIT() instead of BIT_MASK()

Signed-off-by: Menglong Dong 
---
 include/linux/socket.h | 71 ++
 1 file changed, 37 insertions(+), 34 deletions(-)

diff --git a/include/linux/socket.h b/include/linux/socket.h
index 385894b4a8bb..e88859f38cd0 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -283,42 +283,45 @@ struct ucred {
Added those for 1003.1g not all are supported yet
  */
 
-#define MSG_OOB1
-#define MSG_PEEK   2
-#define MSG_DONTROUTE  4
-#define MSG_TRYHARD 4   /* Synonym for MSG_DONTROUTE for DECnet */
-#define MSG_CTRUNC 8
-#define MSG_PROBE  0x10/* Do not send. Only probe path f.e. for MTU */
-#define MSG_TRUNC  0x20
-#define MSG_DONTWAIT   0x40/* Nonblocking io*/
-#define MSG_EOR 0x80   /* End of record */
-#define MSG_WAITALL0x100   /* Wait for a full request */
-#define MSG_FIN 0x200
-#define MSG_SYN0x400
-#define MSG_CONFIRM0x800   /* Confirm path validity */
-#define MSG_RST0x1000
-#define MSG_ERRQUEUE   0x2000  /* Fetch message from error queue */
-#define MSG_NOSIGNAL   0x4000  /* Do not generate SIGPIPE */
-#define MSG_MORE   0x8000  /* Sender will send more */
-#define MSG_WAITFORONE 0x1 /* recvmmsg(): block until 1+ packets avail */
-#define MSG_SENDPAGE_NOPOLICY 0x1 /* sendpage() internal : do no apply 
policy */
-#define MSG_SENDPAGE_NOTLAST 0x2 /* sendpage() internal : not the last 
page */
-#define MSG_BATCH  0x4 /* sendmmsg(): more messages coming */
-#define MSG_EOF MSG_FIN
-#define MSG_NO_SHARED_FRAGS 0x8 /* sendpage() internal : page frags are 
not shared */
-#define MSG_SENDPAGE_DECRYPTED 0x10 /* sendpage() internal : page may carry
- * plain text and require encryption
- */
-
-#define MSG_ZEROCOPY   0x400   /* Use user data in kernel path */
-#define MSG_FASTOPEN   0x2000  /* Send data in TCP SYN */
-#define MSG_CMSG_CLOEXEC 0x4000/* Set close_on_exec for file
-  descriptor received through
-  SCM_RIGHTS */
+#define MSG_OOBBIT(0)
+#define MSG_PEEK   BIT(1)
+#define MSG_DONTROUTE  BIT(2)
+#define MSG_TRYHARDBIT(2)  /* Synonym for MSG_DONTROUTE for DECnet 
*/
+#define MSG_CTRUNC BIT(3)
+#define MSG_PROBE  BIT(4)  /* Do not send. Only probe path f.e. for MTU
*/
+#define MSG_TRUNC  BIT(5)
+#define MSG_DONTWAIT   BIT(6)  /* Nonblocking io   */
+#define MSG_EORBIT(7)  /* End of record*/
+#define MSG_WAITALLBIT(8)  /* Wait for a full request  */
+#define MSG_FINBIT(9)
+#define MSG_SYNBIT(10)
+#define MSG_CONFIRMBIT(11) /* Confirm path validity*/
+#define MSG_RSTBIT(12)
+#define MSG_ERRQUEUE   BIT(13) /* Fetch message from error queue */
+#define MSG_NOSIGNAL   BIT(14) /* Do not generate SIGPIPE  */
+#define MSG_MORE   BIT(15) /* Sender will send more*/
+#define MSG_WAITFORONE BIT(16) /* recvmmsg(): block until 1+ packets avail */
+#define MSG_SENDPAGE_NOPOLICY  BIT(16) /* sendpage() internal : do no apply 
policy */
+#define MSG_SENDPAGE_NOTLAST   BIT(17) /* sendpage() internal : not the last 
page  */
+#define MSG_BATCH  BIT(18) /* sendmmsg(): more messages coming */
+#define MSG_EOFMSG_FIN
+#define MSG_NO_SHARED_FRAGSBIT(19) /* sendpage() internal : page frags
+* are not shared
+*/
+#define MSG_SENDPAGE_DECRYPTED BIT(20) /* sendpage() internal : page may carry
+* plain text and require encryption
+*/
+
+#define MSG_ZEROCOPY   BIT(26) /* Use user data in kernel path */
+#define MSG_FASTOPEN   BIT(29) /* Send data in TCP SYN */
+#define MSG_CMSG_CLOEXEC   BIT(30) /* Set close_on_exec for file
+* descriptor received through
+* SCM_RIGHTS
+*/
 #if defined(CONFIG_COMPAT)
-#define MSG_CMSG_COMPAT0x8000  /* This message needs 32 bit 
fixups */
+#define MSG_CMSG_COMPATBIT(31) /* This message needs 32 bit fixups */
 #else
-#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
+#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups */
 #endif
 
 
-- 
2.25.1



[PATCH v2 net-next] net: socket: use BIT() for MSG_*

2021-02-06 Thread menglong8 . dong
From: Menglong Dong 

The bit mask for MSG_* seems a little confused here. Replace it
with BIT() to make it clear to understand.

Changes since v1:
- use BIT() instead of BIT_MASK()

Signed-off-by: Menglong Dong 
---
 include/linux/socket.h | 71 ++
 1 file changed, 37 insertions(+), 34 deletions(-)

diff --git a/include/linux/socket.h b/include/linux/socket.h
index 385894b4a8bb..cc525d66512d 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -283,42 +283,45 @@ struct ucred {
Added those for 1003.1g not all are supported yet
  */
 
-#define MSG_OOB1
-#define MSG_PEEK   2
-#define MSG_DONTROUTE  4
-#define MSG_TRYHARD 4   /* Synonym for MSG_DONTROUTE for DECnet */
-#define MSG_CTRUNC 8
-#define MSG_PROBE  0x10/* Do not send. Only probe path f.e. for MTU */
-#define MSG_TRUNC  0x20
-#define MSG_DONTWAIT   0x40/* Nonblocking io*/
-#define MSG_EOR 0x80   /* End of record */
-#define MSG_WAITALL0x100   /* Wait for a full request */
-#define MSG_FIN 0x200
-#define MSG_SYN0x400
-#define MSG_CONFIRM0x800   /* Confirm path validity */
-#define MSG_RST0x1000
-#define MSG_ERRQUEUE   0x2000  /* Fetch message from error queue */
-#define MSG_NOSIGNAL   0x4000  /* Do not generate SIGPIPE */
-#define MSG_MORE   0x8000  /* Sender will send more */
-#define MSG_WAITFORONE 0x1 /* recvmmsg(): block until 1+ packets avail */
-#define MSG_SENDPAGE_NOPOLICY 0x1 /* sendpage() internal : do no apply 
policy */
-#define MSG_SENDPAGE_NOTLAST 0x2 /* sendpage() internal : not the last 
page */
-#define MSG_BATCH  0x4 /* sendmmsg(): more messages coming */
-#define MSG_EOF MSG_FIN
-#define MSG_NO_SHARED_FRAGS 0x8 /* sendpage() internal : page frags are 
not shared */
-#define MSG_SENDPAGE_DECRYPTED 0x10 /* sendpage() internal : page may carry
- * plain text and require encryption
- */
-
-#define MSG_ZEROCOPY   0x400   /* Use user data in kernel path */
-#define MSG_FASTOPEN   0x2000  /* Send data in TCP SYN */
-#define MSG_CMSG_CLOEXEC 0x4000/* Set close_on_exec for file
-  descriptor received through
-  SCM_RIGHTS */
+#define MSG_OOBBIT(0)
+#define MSG_PEEK   BIT(1)
+#define MSG_DONTROUTE  BIT(2)
+#define MSG_TRYHARDBIT(2)  /* Synonym for MSG_DONTROUTE for DECnet 
*/
+#define MSG_CTRUNC BIT(3)
+#define MSG_PROBE  BIT(4)  /* Do not send. Only probe path f.e. for MTU
*/
+#define MSG_TRUNC  BIT(5)
+#define MSG_DONTWAIT   BIT(6)  /* Nonblocking io   */
+#define MSG_EORBIT(7)  /* End of record*/
+#define MSG_WAITALLBIT(8)  /* Wait for a full request  */
+#define MSG_FINBIT(9)
+#define MSG_SYNBIT(10)
+#define MSG_CONFIRMBIT(11) /* Confirm path validity*/
+#define MSG_RSTBIT(12)
+#define MSG_ERRQUEUE   BIT(13) /* Fetch message from error queue */
+#define MSG_NOSIGNAL   BIT(14) /* Do not generate SIGPIPE  */
+#define MSG_MORE   BIT(15) /* Sender will send more*/
+#define MSG_WAITFORONE BIT(16) /* recvmmsg(): block until 1+ packets avail */
+#define MSG_SENDPAGE_NOPOLICY  BIT(16) /* sendpage() internal : do no apply 
policy */
+#define MSG_SENDPAGE_NOTLAST   BIT(17) /* sendpage() internal : not the last 
page  */
+#define MSG_BATCH  BIT(18) /* sendmmsg(): more messages coming */
+#define MSG_EOFMSG_FIN
+#define MSG_NO_SHARED_FRAGSBIT(19) /* sendpage() internal : page frags
+* are not shared
+*/
+#define MSG_SENDPAGE_DECRYPTED BIT(20) /* sendpage() internal : page may carry
+* plain text and require encryption
+*/
+
+#define MSG_ZEROCOPY   BIT(26) /* Use user data in kernel path */
+#define MSG_FASTOPEN   BIT(29) /* Send data in TCP SYN */
+#define MSG_CMSG_CLOEXEC   BIT(30) /* Set close_on_exec for file
+* descriptor received through
+* SCM_RIGHTS
+*/
 #if defined(CONFIG_COMPAT)
-#define MSG_CMSG_COMPAT0x8000  /* This message needs 32 bit 
fixups */
+#define MSG_CMSG_COMPATBIT_MASK(31)/* This message needs 32 bit 
fixups */
 #else
-#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
+#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups */
 #endif
 
 
-- 
2.25.1



[PATCH net-next] net: socket: use BIT_MASK for MSG_*

2021-02-05 Thread menglong8 . dong
From: Menglong Dong 

The bit mask for MSG_* seems a little confused here. Replace it
with BIT_MASK to make it clear to understand.

Signed-off-by: Menglong Dong 
---
 include/linux/socket.h | 71 ++
 1 file changed, 37 insertions(+), 34 deletions(-)

diff --git a/include/linux/socket.h b/include/linux/socket.h
index 385894b4a8bb..671d31c41582 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -283,42 +283,45 @@ struct ucred {
Added those for 1003.1g not all are supported yet
  */
 
-#define MSG_OOB1
-#define MSG_PEEK   2
-#define MSG_DONTROUTE  4
-#define MSG_TRYHARD 4   /* Synonym for MSG_DONTROUTE for DECnet */
-#define MSG_CTRUNC 8
-#define MSG_PROBE  0x10/* Do not send. Only probe path f.e. for MTU */
-#define MSG_TRUNC  0x20
-#define MSG_DONTWAIT   0x40/* Nonblocking io*/
-#define MSG_EOR 0x80   /* End of record */
-#define MSG_WAITALL0x100   /* Wait for a full request */
-#define MSG_FIN 0x200
-#define MSG_SYN0x400
-#define MSG_CONFIRM0x800   /* Confirm path validity */
-#define MSG_RST0x1000
-#define MSG_ERRQUEUE   0x2000  /* Fetch message from error queue */
-#define MSG_NOSIGNAL   0x4000  /* Do not generate SIGPIPE */
-#define MSG_MORE   0x8000  /* Sender will send more */
-#define MSG_WAITFORONE 0x1 /* recvmmsg(): block until 1+ packets avail */
-#define MSG_SENDPAGE_NOPOLICY 0x1 /* sendpage() internal : do no apply 
policy */
-#define MSG_SENDPAGE_NOTLAST 0x2 /* sendpage() internal : not the last 
page */
-#define MSG_BATCH  0x4 /* sendmmsg(): more messages coming */
-#define MSG_EOF MSG_FIN
-#define MSG_NO_SHARED_FRAGS 0x8 /* sendpage() internal : page frags are 
not shared */
-#define MSG_SENDPAGE_DECRYPTED 0x10 /* sendpage() internal : page may carry
- * plain text and require encryption
- */
-
-#define MSG_ZEROCOPY   0x400   /* Use user data in kernel path */
-#define MSG_FASTOPEN   0x2000  /* Send data in TCP SYN */
-#define MSG_CMSG_CLOEXEC 0x4000/* Set close_on_exec for file
-  descriptor received through
-  SCM_RIGHTS */
+#define MSG_OOBBIT_MASK(0)
+#define MSG_PEEK   BIT_MASK(1)
+#define MSG_DONTROUTE  BIT_MASK(2)
+#define MSG_TRYHARDBIT_MASK(2) /* Synonym for MSG_DONTROUTE for DECnet 
*/
+#define MSG_CTRUNC BIT_MASK(3)
+#define MSG_PROBE  BIT_MASK(4) /* Do not send. Only probe path f.e. 
for MTU*/
+#define MSG_TRUNC  BIT_MASK(5)
+#define MSG_DONTWAIT   BIT_MASK(6) /* Nonblocking io   */
+#define MSG_EORBIT_MASK(7) /* End of record
*/
+#define MSG_WAITALLBIT_MASK(8) /* Wait for a full request  */
+#define MSG_FINBIT_MASK(9)
+#define MSG_SYNBIT_MASK(10)
+#define MSG_CONFIRMBIT_MASK(11)/* Confirm path validity*/
+#define MSG_RSTBIT_MASK(12)
+#define MSG_ERRQUEUE   BIT_MASK(13)/* Fetch message from error queue */
+#define MSG_NOSIGNAL   BIT_MASK(14)/* Do not generate SIGPIPE  */
+#define MSG_MORE   BIT_MASK(15)/* Sender will send more*/
+#define MSG_WAITFORONE BIT_MASK(16)/* recvmmsg(): block until 1+ packets 
avail */
+#define MSG_SENDPAGE_NOPOLICY  BIT_MASK(16)/* sendpage() internal : do no 
apply policy */
+#define MSG_SENDPAGE_NOTLAST   BIT_MASK(17)/* sendpage() internal : not 
the last page  */
+#define MSG_BATCH  BIT_MASK(18)/* sendmmsg(): more messages 
coming */
+#define MSG_EOFMSG_FIN
+#define MSG_NO_SHARED_FRAGSBIT_MASK(19)/* sendpage() internal : page 
frags
+* are not shared
+*/
+#define MSG_SENDPAGE_DECRYPTED BIT_MASK(20)/* sendpage() internal : page 
may carry
+* plain text and require 
encryption
+*/
+
+#define MSG_ZEROCOPY   BIT_MASK(26)/* Use user data in kernel path */
+#define MSG_FASTOPEN   BIT_MASK(29)/* Send data in TCP SYN */
+#define MSG_CMSG_CLOEXEC   BIT_MASK(30)/* Set close_on_exec for file
+* descriptor received through
+* SCM_RIGHTS
+*/
 #if defined(CONFIG_COMPAT)
-#define MSG_CMSG_COMPAT0x8000  /* This message needs 32 bit 
fixups */
+#define MSG_CMSG_COMPATBIT_MASK(31)/* This message needs 32 bit 
fixups */
 #else
-#define MSG_CMSG_COMPAT0   /* We never have 32 bit fixups 
*/
+#define MSG_CMSG_COMPAT   

[PATCH] jffs2: check the validity of dstlen in jffs2_zlib_compress()

2021-01-28 Thread menglong8 . dong
From: Yang Yang 

KASAN reports a BUG when download file in jffs2 filesystem.It is
because when dstlen == 1, cpage_out will write array out of bounds.
Actually, data will not be compressed in jffs2_zlib_compress() if
data's length less than 4.

[  393.799778] BUG: KASAN: slab-out-of-bounds in 
jffs2_rtime_compress+0x214/0x2f0 at addr 800062e3b281
[  393.809166] Write of size 1 by task tftp/2918
[  393.813526] CPU: 3 PID: 2918 Comm: tftp Tainted: GB   
4.9.115-rt93-EMBSYS-CGEL-6.1.R6-dirty #1
[  393.823173] Hardware name: LS1043A RDB Board (DT)
[  393.827870] Call trace:
[  393.830322] [] dump_backtrace+0x0/0x2f0
[  393.835721] [] show_stack+0x14/0x20
[  393.840774] [] dump_stack+0x90/0xb0
[  393.845829] [] kasan_object_err+0x24/0x80
[  393.851402] [] kasan_report_error+0x1b4/0x4d8
[  393.857323] [] kasan_report+0x38/0x40
[  393.862548] [] __asan_store1+0x4c/0x58
[  393.867859] [] jffs2_rtime_compress+0x214/0x2f0
[  393.873955] [] jffs2_selected_compress+0x178/0x2a0
[  393.880308] [] jffs2_compress+0x58/0x478
[  393.885796] [] jffs2_write_inode_range+0x13c/0x450
[  393.892150] [] jffs2_write_end+0x2a8/0x4a0
[  393.897811] [] generic_perform_write+0x1c0/0x280
[  393.903990] [] __generic_file_write_iter+0x1c4/0x228
[  393.910517] [] generic_file_write_iter+0x138/0x288
[  393.916870] [] __vfs_write+0x1b4/0x238
[  393.922181] [] vfs_write+0xd0/0x238
[  393.927232] [] SyS_write+0xa0/0x110
[  393.932283] [] __sys_trace_return+0x0/0x4
[  393.937851] Object at 800062e3b280, in cache kmalloc-64 size: 64
[  393.944197] Allocated:
[  393.946552] PID = 2918
[  393.948913]  save_stack_trace_tsk+0x0/0x220
[  393.953096]  save_stack_trace+0x18/0x20
[  393.956932]  kasan_kmalloc+0xd8/0x188
[  393.960594]  __kmalloc+0x144/0x238
[  393.963994]  jffs2_selected_compress+0x48/0x2a0
[  393.968524]  jffs2_compress+0x58/0x478
[  393.972273]  jffs2_write_inode_range+0x13c/0x450
[  393.976889]  jffs2_write_end+0x2a8/0x4a0
[  393.980810]  generic_perform_write+0x1c0/0x280
[  393.985251]  __generic_file_write_iter+0x1c4/0x228
[  393.990040]  generic_file_write_iter+0x138/0x288
[  393.994655]  __vfs_write+0x1b4/0x238
[  393.998228]  vfs_write+0xd0/0x238
[  394.001543]  SyS_write+0xa0/0x110
[  394.004856]  __sys_trace_return+0x0/0x4
[  394.008684] Freed:
[  394.010691] PID = 2918
[  394.013051]  save_stack_trace_tsk+0x0/0x220
[  394.017233]  save_stack_trace+0x18/0x20
[  394.021069]  kasan_slab_free+0x88/0x188
[  394.024902]  kfree+0x6c/0x1d8
[  394.027868]  jffs2_sum_write_sumnode+0x2c4/0x880
[  394.032486]  jffs2_do_reserve_space+0x198/0x598
[  394.037016]  jffs2_reserve_space+0x3f8/0x4d8
[  394.041286]  jffs2_write_inode_range+0xf0/0x450
[  394.045816]  jffs2_write_end+0x2a8/0x4a0
[  394.049737]  generic_perform_write+0x1c0/0x280
[  394.054179]  __generic_file_write_iter+0x1c4/0x228
[  394.058968]  generic_file_write_iter+0x138/0x288
[  394.063583]  __vfs_write+0x1b4/0x238
[  394.067157]  vfs_write+0xd0/0x238
[  394.070470]  SyS_write+0xa0/0x110
[  394.073783]  __sys_trace_return+0x0/0x4
[  394.077612] Memory state around the buggy address:
[  394.082404]  800062e3b180: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc 
fc
[  394.089623]  800062e3b200: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc 
fc
[  394.096842] >800062e3b280: 01 fc fc fc fc fc fc fc fc fc fc fc fc fc fc 
fc
[  394.104056]^
[  394.107283]  800062e3b300: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc 
fc
[  394.114502]  800062e3b380: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc 
fc
[  394.121718] 
==

Signed-off-by: Yang Yang 
---
 fs/jffs2/compr_rtime.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/jffs2/compr_rtime.c b/fs/jffs2/compr_rtime.c
index 406d9cc84ba8..79e771ab624f 100644
--- a/fs/jffs2/compr_rtime.c
+++ b/fs/jffs2/compr_rtime.c
@@ -37,6 +37,9 @@ static int jffs2_rtime_compress(unsigned char *data_in,
int outpos = 0;
int pos=0;
 
+   if (*dstlen <= 3)
+   return -1;
+
memset(positions,0,sizeof(positions));
 
while (pos < (*sourcelen) && outpos <= (*dstlen)-2) {
-- 
2.25.1



[PATCH net-next] net: packet: make pkt_sk() inline

2021-01-27 Thread menglong8 . dong
From: Menglong Dong 

It's better make 'pkt_sk()' inline here, as non-inline function
shouldn't occur in headers. Besides, this function is simple
enough to be inline.

Signed-off-by: Menglong Dong 
---
 net/packet/internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/packet/internal.h b/net/packet/internal.h
index baafc3f3fa25..5f61e59ebbff 100644
--- a/net/packet/internal.h
+++ b/net/packet/internal.h
@@ -139,7 +139,7 @@ struct packet_sock {
atomic_ttp_drops cacheline_aligned_in_smp;
 };
 
-static struct packet_sock *pkt_sk(struct sock *sk)
+static inline struct packet_sock *pkt_sk(struct sock *sk)
 {
return (struct packet_sock *)sk;
 }
-- 
2.25.1



[PATCH v2] drm/omap: dsi: fix unreachable code in dsi_vc_send_short()

2021-01-26 Thread menglong8 . dong
From: Menglong Dong 

The 'r' in dsi_vc_send_short() is of type 'unsigned int', so the
'r < 0' can't be true.

Fix this by introducing a 'err' of type 'int' insteaded.

Fixes: 1ed6253856cb ("drm/omap: dsi: switch dsi_vc_send_long/short to 
mipi_dsi_msg")

Signed-off-by: Menglong Dong 
Reviewed-by: Sebastian Reichel 
---
v2:
- remove word wrap in 'Fixes' tag
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 8e11612f5fe1..febcc87ddfe1 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2149,11 +2149,12 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int 
vc,
 const struct mipi_dsi_msg *msg)
 {
struct mipi_dsi_packet pkt;
+   int err;
u32 r;
 
-   r = mipi_dsi_create_packet(, msg);
-   if (r < 0)
-   return r;
+   err = mipi_dsi_create_packet(, msg);
+   if (err)
+   return err;
 
WARN_ON(!dsi_bus_is_locked(dsi));
 
-- 
2.25.1



[PATCH v2] audit: Make audit_filter_syscall() return void

2021-01-26 Thread menglong8 . dong
From: Yang Yang 

No invoker uses the return value of audit_filter_syscall().
So make it return void, and amend the comment of
audit_filter_syscall().

Changes since v1:
- amend the comment of audit_filter_syscall().

Signed-off-by: Yang Yang 
Reviewed-by: Richard Guy Briggs 
---
 kernel/auditsc.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index ce8c9e2279ba..434337ab6b2b 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -799,12 +799,12 @@ static int audit_in_mask(const struct audit_krule *rule, 
unsigned long val)
return rule->mask[word] & bit;
 }
 
-/* At syscall entry and exit time, this filter is called if the
- * audit_state is not low enough that auditing cannot take place, but is
- * also not high enough that we already know we have to write an audit
- * record (i.e., the state is AUDIT_SETUP_CONTEXT or AUDIT_BUILD_CONTEXT).
+/* At syscall exit time, this filter is called if the audit_state is
+ * not low enough that auditing cannot take place, but is also not
+ * high enough that we already know we have to write an audit record
+ * (i.e., the state is AUDIT_SETUP_CONTEXT or AUDIT_BUILD_CONTEXT).
  */
-static enum audit_state audit_filter_syscall(struct task_struct *tsk,
+static void audit_filter_syscall(struct task_struct *tsk,
 struct audit_context *ctx,
 struct list_head *list)
 {
@@ -812,7 +812,7 @@ static enum audit_state audit_filter_syscall(struct 
task_struct *tsk,
enum audit_state state;
 
if (auditd_test_task(tsk))
-   return AUDIT_DISABLED;
+   return;
 
rcu_read_lock();
list_for_each_entry_rcu(e, list, list) {
@@ -821,11 +821,11 @@ static enum audit_state audit_filter_syscall(struct 
task_struct *tsk,
   , false)) {
rcu_read_unlock();
ctx->current_state = state;
-   return state;
+   return;
}
}
rcu_read_unlock();
-   return AUDIT_BUILD_CONTEXT;
+   return;
 }
 
 /*
-- 
2.25.1



[PATCH bpf-next] bpf: change 'BPF_ADD' to 'BPF_AND' in print_bpf_insn()

2021-01-26 Thread menglong8 . dong
From: Menglong Dong 

This 'BPF_ADD' is duplicated, and I belive it should be 'BPF_AND'.

Fixes: 981f94c3e921 ("bpf: Add bitwise atomic instructions")
Signed-off-by: Menglong Dong 
---
 kernel/bpf/disasm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/disasm.c b/kernel/bpf/disasm.c
index 19ff8fed7f4b..3acc7e0b6916 100644
--- a/kernel/bpf/disasm.c
+++ b/kernel/bpf/disasm.c
@@ -161,7 +161,7 @@ void print_bpf_insn(const struct bpf_insn_cbs *cbs,
insn->dst_reg,
insn->off, insn->src_reg);
else if (BPF_MODE(insn->code) == BPF_ATOMIC &&
-(insn->imm == BPF_ADD || insn->imm == BPF_ADD ||
+(insn->imm == BPF_ADD || insn->imm == BPF_AND ||
  insn->imm == BPF_OR || insn->imm == BPF_XOR)) {
verbose(cbs->private_data, "(%02x) lock *(%s *)(r%d 
%+d) %s r%d\n",
insn->code,
-- 
2.25.1



[PATCH] drm/omap: dsi: fix unreachable code in dsi_vc_send_short()

2021-01-26 Thread menglong8 . dong
From: Menglong Dong 

The 'r' in dsi_vc_send_short() is of type 'unsigned int', so the
'r < 0' can't be true.

Fix this by introducing a 'err' insteaded.

Fixes: 1ed6253856cb
("drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg")

Signed-off-by: Menglong Dong 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 8e11612f5fe1..febcc87ddfe1 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2149,11 +2149,12 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int 
vc,
 const struct mipi_dsi_msg *msg)
 {
struct mipi_dsi_packet pkt;
+   int err;
u32 r;
 
-   r = mipi_dsi_create_packet(, msg);
-   if (r < 0)
-   return r;
+   err = mipi_dsi_create_packet(, msg);
+   if (err)
+   return err;
 
WARN_ON(!dsi_bus_is_locked(dsi));
 
-- 
2.25.1



[PATCH] audit: Make audit_filter_syscall() return void

2021-01-26 Thread menglong8 . dong
From: Yang Yang 

No invoker users the return value of audit_filter_syscall().
So make it return void.

Signed-off-by: Yang Yang 
---
 kernel/auditsc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index ce8c9e2279ba..c8e16b9c0f21 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -804,7 +804,7 @@ static int audit_in_mask(const struct audit_krule *rule, 
unsigned long val)
  * also not high enough that we already know we have to write an audit
  * record (i.e., the state is AUDIT_SETUP_CONTEXT or AUDIT_BUILD_CONTEXT).
  */
-static enum audit_state audit_filter_syscall(struct task_struct *tsk,
+static void audit_filter_syscall(struct task_struct *tsk,
 struct audit_context *ctx,
 struct list_head *list)
 {
@@ -812,7 +812,7 @@ static enum audit_state audit_filter_syscall(struct 
task_struct *tsk,
enum audit_state state;
 
if (auditd_test_task(tsk))
-   return AUDIT_DISABLED;
+   return;
 
rcu_read_lock();
list_for_each_entry_rcu(e, list, list) {
@@ -821,11 +821,11 @@ static enum audit_state audit_filter_syscall(struct 
task_struct *tsk,
   , false)) {
rcu_read_unlock();
ctx->current_state = state;
-   return state;
+   return;
}
}
rcu_read_unlock();
-   return AUDIT_BUILD_CONTEXT;
+   return;
 }
 
 /*
-- 
2.25.1



[PATCH net-next 0/3] Namespace-ify some sysctl in net/core

2021-01-18 Thread menglong8 . dong
From: Menglong Dong 

For now, most sysctl in 'net/core' are globally unified, such as
sysctl_wmem_default, sysctl_rmem_default, sysctl_wmem_default,
sysctl_rmem_default, etc.

It's not convenient in some case. For example, when we use docker
and try to control the default udp socket receive buffer for
each container by sysctl_rmem_default.

For that reason, I namespace-ify some sysctl in 'net/core', which
are sysctl_wmem_default, sysctl_rmem_default, sysctl_wmem_default
and sysctl_rmem_default.

In the first patch, I made some adjustments to the initialization
of netns_core_table.

The second patch make sysctl_wmem_default and sysctl_rmem_default
per-namespace, and the third patch make sysctl_wmem_max and
sysctl_rmem_max per-namespace.

After these patch, sysctl above are pre-namespace, for example:

$ cat /proc/sys/net/core/rmem_default
1024000
$ ip netns exec test cat /proc/sys/net/core/rmem_default
212992
$ ip netns exec test2 cat /proc/sys/net/core/rmem_default
2048000

Thanks for Christian's patient explaining to make these patches a
single series~

Menglong Dong (3):
  net: core: init every ctl_table in netns_core_table
  net: core: Namespace-ify sysctl_wmem_default and sysctl_rmem_default
  net: core: Namespace-ify sysctl_rmem_max and sysctl_wmem_max

 include/net/netns/core.h|  4 ++
 include/net/sock.h  |  6 ---
 net/core/filter.c   |  4 +-
 net/core/net_namespace.c|  4 ++
 net/core/sock.c | 18 +++-
 net/core/sysctl_net_core.c  | 76 +
 net/ipv4/ip_output.c|  2 +-
 net/ipv4/tcp_output.c   |  2 +-
 net/netfilter/ipvs/ip_vs_sync.c |  4 +-
 9 files changed, 60 insertions(+), 60 deletions(-)


base-commit: 5ee88057889bbca5f5bb96031b62b3756b33e164
-- 
2.30.0



[PATCH net-next 1/3] net: core: init every ctl_table in netns_core_table

2021-01-18 Thread menglong8 . dong
From: Menglong Dong 

For now, there is only one element in netns_core_table, and it is inited
directly in sysctl_core_net_init. To make it more flexible, we can init
every element at once, just like what ipv4_sysctl_init_net() did.

Signed-off-by: Menglong Dong 
---
 net/core/sysctl_net_core.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index d86d8d11cfe4..966d976dee84 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -606,15 +606,19 @@ static __net_init int sysctl_core_net_init(struct net 
*net)
 
tbl = netns_core_table;
if (!net_eq(net, _net)) {
+   int i;
+
tbl = kmemdup(tbl, sizeof(netns_core_table), GFP_KERNEL);
if (tbl == NULL)
goto err_dup;
 
-   tbl[0].data = >core.sysctl_somaxconn;
+   /* Update the variables to point into the current struct net */
+   for (i = 0; i < ARRAY_SIZE(netns_core_table) - 1; i++) {
+   tbl[i].data += (void *)net - (void *)_net;
 
-   /* Don't export any sysctls to unprivileged users */
-   if (net->user_ns != _user_ns) {
-   tbl[0].procname = NULL;
+   /* Don't export any sysctls to unprivileged users */
+   if (net->user_ns != _user_ns)
+   tbl[i].procname = NULL;
}
}
 
-- 
2.30.0



[PATCH net-next 3/3] net: core: Namespace-ify sysctl_rmem_max and sysctl_wmem_max

2021-01-18 Thread menglong8 . dong
From: Menglong Dong 

For now, sysctl_wmem_max and sysctl_rmem_max are globally unified.
It's not convenient in some case. For example, when we use docker
and try to control the default udp socket receive buffer for each
container.

For that reason, make sysctl_wmem_max and sysctl_rmem_max
per-namespace.

Signed-off-by: Menglong Dong 
---
 include/net/netns/core.h|  2 ++
 include/net/sock.h  |  3 ---
 net/core/filter.c   |  4 ++--
 net/core/net_namespace.c|  2 ++
 net/core/sock.c | 12 
 net/core/sysctl_net_core.c  | 32 
 net/ipv4/tcp_output.c   |  2 +-
 net/netfilter/ipvs/ip_vs_sync.c |  4 ++--
 8 files changed, 29 insertions(+), 32 deletions(-)

diff --git a/include/net/netns/core.h b/include/net/netns/core.h
index 317b47df6d08..b4aecac6e8ce 100644
--- a/include/net/netns/core.h
+++ b/include/net/netns/core.h
@@ -11,6 +11,8 @@ struct netns_core {
 
int sysctl_wmem_default;
int sysctl_rmem_default;
+   int sysctl_wmem_max;
+   int sysctl_rmem_max;
int sysctl_somaxconn;
 
 #ifdef CONFIG_PROC_FS
diff --git a/include/net/sock.h b/include/net/sock.h
index b846a6d24459..f6b0f2c482ad 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2647,9 +2647,6 @@ void sk_get_meminfo(const struct sock *sk, u32 *meminfo);
 #define SK_WMEM_MAX(_SK_MEM_OVERHEAD * _SK_MEM_PACKETS)
 #define SK_RMEM_MAX(_SK_MEM_OVERHEAD * _SK_MEM_PACKETS)
 
-extern __u32 sysctl_wmem_max;
-extern __u32 sysctl_rmem_max;
-
 extern int sysctl_tstamp_allow_data;
 extern int sysctl_optmem_max;
 
diff --git a/net/core/filter.c b/net/core/filter.c
index 255aeee72402..3dca58f6c40c 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4717,13 +4717,13 @@ static int _bpf_setsockopt(struct sock *sk, int level, 
int optname,
/* Only some socketops are supported */
switch (optname) {
case SO_RCVBUF:
-   val = min_t(u32, val, sysctl_rmem_max);
+   val = min_t(u32, val, 
sock_net(sk)->core.sysctl_rmem_max);
sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
WRITE_ONCE(sk->sk_rcvbuf,
   max_t(int, val * 2, SOCK_MIN_RCVBUF));
break;
case SO_SNDBUF:
-   val = min_t(u32, val, sysctl_wmem_max);
+   val = min_t(u32, val, 
sock_net(sk)->core.sysctl_wmem_max);
sk->sk_userlocks |= SOCK_SNDBUF_LOCK;
WRITE_ONCE(sk->sk_sndbuf,
   max_t(int, val * 2, SOCK_MIN_SNDBUF));
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index eb4ea99131d6..552e3c5b2a41 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -376,6 +376,8 @@ static int __net_init net_defaults_init_net(struct net *net)
 {
net->core.sysctl_rmem_default = SK_RMEM_MAX;
net->core.sysctl_wmem_default = SK_WMEM_MAX;
+   net->core.sysctl_rmem_max = SK_RMEM_MAX;
+   net->core.sysctl_wmem_max = SK_WMEM_MAX;
net->core.sysctl_somaxconn = SOMAXCONN;
return 0;
 }
diff --git a/net/core/sock.c b/net/core/sock.c
index 2421e4ea1915..eb7eaaa840ce 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -265,12 +265,6 @@ static struct lock_class_key af_wlock_keys[AF_MAX];
 static struct lock_class_key af_elock_keys[AF_MAX];
 static struct lock_class_key af_kern_callback_keys[AF_MAX];
 
-/* Run time adjustable parameters. */
-__u32 sysctl_wmem_max __read_mostly = SK_WMEM_MAX;
-EXPORT_SYMBOL(sysctl_wmem_max);
-__u32 sysctl_rmem_max __read_mostly = SK_RMEM_MAX;
-EXPORT_SYMBOL(sysctl_rmem_max);
-
 /* Maximal space eaten by iovec or ancillary data plus some space */
 int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512);
 EXPORT_SYMBOL(sysctl_optmem_max);
@@ -877,7 +871,7 @@ int sock_setsockopt(struct socket *sock, int level, int 
optname,
 * play 'guess the biggest size' games. RCVBUF/SNDBUF
 * are treated in BSD as hints
 */
-   val = min_t(u32, val, sysctl_wmem_max);
+   val = min_t(u32, val, sock_net(sk)->core.sysctl_wmem_max);
 set_sndbuf:
/* Ensure val * 2 fits into an int, to prevent max_t()
 * from treating it as a negative value.
@@ -909,7 +903,9 @@ int sock_setsockopt(struct socket *sock, int level, int 
optname,
 * play 'guess the biggest size' games. RCVBUF/SNDBUF
 * are treated in BSD as hints
 */
-   __sock_set_rcvbuf(sk, min_t(u32, val, sysctl_rmem_max));
+   __sock_set_rcvbuf(sk,
+ min_t(u32, val,
+   sock_net(sk)->core.sysctl_rmem_max));
break;
 
case SO_RCVBUFFORCE:
diff 

[PATCH net-next 2/3] net: core: Namespace-ify sysctl_wmem_default and sysctl_rmem_default

2021-01-18 Thread menglong8 . dong
From: Menglong Dong 

For now, sysctl_wmem_default and sysctl_rmem_default are globally
unified. It's not convenient in some case. For example, when we
use docker and try to control the default udp socket receive buffer
for each container.

For that reason, make sysctl_wmem_default and sysctl_rmem_default
per-namespace.

Signed-off-by: Menglong Dong 
---
 include/net/netns/core.h   |  2 ++
 include/net/sock.h |  3 ---
 net/core/net_namespace.c   |  2 ++
 net/core/sock.c|  6 ++
 net/core/sysctl_net_core.c | 32 
 net/ipv4/ip_output.c   |  2 +-
 6 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/include/net/netns/core.h b/include/net/netns/core.h
index 36c2d998a43c..317b47df6d08 100644
--- a/include/net/netns/core.h
+++ b/include/net/netns/core.h
@@ -9,6 +9,8 @@ struct netns_core {
/* core sysctls */
struct ctl_table_header *sysctl_hdr;
 
+   int sysctl_wmem_default;
+   int sysctl_rmem_default;
int sysctl_somaxconn;
 
 #ifdef CONFIG_PROC_FS
diff --git a/include/net/sock.h b/include/net/sock.h
index bdc4323ce53c..b846a6d24459 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2653,9 +2653,6 @@ extern __u32 sysctl_rmem_max;
 extern int sysctl_tstamp_allow_data;
 extern int sysctl_optmem_max;
 
-extern __u32 sysctl_wmem_default;
-extern __u32 sysctl_rmem_default;
-
 DECLARE_STATIC_KEY_FALSE(net_high_order_alloc_disable_key);
 
 static inline int sk_get_wmem0(const struct sock *sk, const struct proto 
*proto)
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 2ef3b4557f40..eb4ea99131d6 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -374,6 +374,8 @@ static __net_init int setup_net(struct net *net, struct 
user_namespace *user_ns)
 
 static int __net_init net_defaults_init_net(struct net *net)
 {
+   net->core.sysctl_rmem_default = SK_RMEM_MAX;
+   net->core.sysctl_wmem_default = SK_WMEM_MAX;
net->core.sysctl_somaxconn = SOMAXCONN;
return 0;
 }
diff --git a/net/core/sock.c b/net/core/sock.c
index bbcd4b97eddd..2421e4ea1915 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -270,8 +270,6 @@ __u32 sysctl_wmem_max __read_mostly = SK_WMEM_MAX;
 EXPORT_SYMBOL(sysctl_wmem_max);
 __u32 sysctl_rmem_max __read_mostly = SK_RMEM_MAX;
 EXPORT_SYMBOL(sysctl_rmem_max);
-__u32 sysctl_wmem_default __read_mostly = SK_WMEM_MAX;
-__u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX;
 
 /* Maximal space eaten by iovec or ancillary data plus some space */
 int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512);
@@ -2970,8 +2968,8 @@ void sock_init_data(struct socket *sock, struct sock *sk)
timer_setup(>sk_timer, NULL, 0);
 
sk->sk_allocation   =   GFP_KERNEL;
-   sk->sk_rcvbuf   =   sysctl_rmem_default;
-   sk->sk_sndbuf   =   sysctl_wmem_default;
+   sk->sk_rcvbuf   =   sock_net(sk)->core.sysctl_rmem_default;
+   sk->sk_sndbuf   =   sock_net(sk)->core.sysctl_wmem_default;
sk->sk_state=   TCP_CLOSE;
sk_set_socket(sk, sock);
 
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 966d976dee84..5c1c75e42a09 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -326,22 +326,6 @@ static struct ctl_table net_core_table[] = {
.proc_handler   = proc_dointvec_minmax,
.extra1 = _rcvbuf,
},
-   {
-   .procname   = "wmem_default",
-   .data   = _wmem_default,
-   .maxlen = sizeof(int),
-   .mode   = 0644,
-   .proc_handler   = proc_dointvec_minmax,
-   .extra1 = _sndbuf,
-   },
-   {
-   .procname   = "rmem_default",
-   .data   = _rmem_default,
-   .maxlen = sizeof(int),
-   .mode   = 0644,
-   .proc_handler   = proc_dointvec_minmax,
-   .extra1 = _rcvbuf,
-   },
{
.procname   = "dev_weight",
.data   = _p,
@@ -584,6 +568,22 @@ static struct ctl_table netns_core_table[] = {
.extra1 = SYSCTL_ZERO,
.proc_handler   = proc_dointvec_minmax
},
+   {
+   .procname   = "wmem_default",
+   .data   = _net.core.sysctl_wmem_default,
+   .maxlen = sizeof(int),
+   .mode   = 0644,
+   .proc_handler   = proc_dointvec_minmax,
+   .extra1 = _sndbuf,
+   },
+   {
+   .procname   = "rmem_default",
+   .data   = _net.core.sysctl_rmem_default,
+   .maxlen = sizeof(int),
+   .mode   = 0644,
+   .proc_handler   = 

[PATCH net-next] net: tun: fix misspellings using codespell tool

2021-01-18 Thread menglong8 . dong
From: Menglong Dong 

Some typos are found out by codespell tool:

$ codespell -w -i 3 ./drivers/net/tun.c
aovid  ==> avoid

Fix typos found by codespell.

Signed-off-by: Menglong Dong 
---
 drivers/net/tun.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 702215596889..62690baa19bc 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2735,7 +2735,7 @@ static int tun_set_iff(struct net *net, struct file 
*file, struct ifreq *ifr)
err = register_netdevice(tun->dev);
if (err < 0)
goto err_detach;
-   /* free_netdev() won't check refcnt, to aovid race
+   /* free_netdev() won't check refcnt, to avoid race
 * with dev_put() we need publish tun after registration.
 */
rcu_assign_pointer(tfile->tun, tun);
-- 
2.25.1



[PATCH] workqueue: fix annotation for WQ_SYSFS

2021-01-18 Thread menglong8 . dong
From: Menglong Dong 

'wq_sysfs_register()' in annotation for 'WQ_SYSFS' is unavailable,
change it to 'workqueue_sysfs_register()'.

Signed-off-by: Menglong Dong 
---
 include/linux/workqueue.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 26de0cae2a0a..d15a7730ee18 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -311,7 +311,7 @@ enum {
WQ_MEM_RECLAIM  = 1 << 3, /* may be used for memory reclaim */
WQ_HIGHPRI  = 1 << 4, /* high priority */
WQ_CPU_INTENSIVE= 1 << 5, /* cpu intensive workqueue */
-   WQ_SYSFS= 1 << 6, /* visible in sysfs, see 
wq_sysfs_register() */
+   WQ_SYSFS= 1 << 6, /* visible in sysfs, see 
workqueue_sysfs_register() */
 
/*
 * Per-cpu workqueues are generally preferred because they tend to
-- 
2.25.1



[PATCH net-next] net: core: Namespace-ify sysctl_rmem_max and sysctl_wmem_max

2021-01-17 Thread menglong8 . dong
From: Menglong Dong 

For now, sysctl_wmem_max and sysctl_rmem_max are globally unified.
It's not convenient in some case. For example, when we use docker
and try to control the default udp socket receive buffer for each
container.

For that reason, make sysctl_wmem_max and sysctl_rmem_max
per-namespace.

Signed-off-by: Menglong Dong 
---
 include/net/netns/core.h|  2 ++
 include/net/sock.h  |  3 ---
 net/core/filter.c   |  4 ++--
 net/core/net_namespace.c|  2 ++
 net/core/sock.c | 12 
 net/core/sysctl_net_core.c  | 32 
 net/ipv4/tcp_output.c   |  2 +-
 net/netfilter/ipvs/ip_vs_sync.c |  4 ++--
 8 files changed, 29 insertions(+), 32 deletions(-)

diff --git a/include/net/netns/core.h b/include/net/netns/core.h
index 317b47df6d08..b4aecac6e8ce 100644
--- a/include/net/netns/core.h
+++ b/include/net/netns/core.h
@@ -11,6 +11,8 @@ struct netns_core {
 
int sysctl_wmem_default;
int sysctl_rmem_default;
+   int sysctl_wmem_max;
+   int sysctl_rmem_max;
int sysctl_somaxconn;
 
 #ifdef CONFIG_PROC_FS
diff --git a/include/net/sock.h b/include/net/sock.h
index b846a6d24459..f6b0f2c482ad 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2647,9 +2647,6 @@ void sk_get_meminfo(const struct sock *sk, u32 *meminfo);
 #define SK_WMEM_MAX(_SK_MEM_OVERHEAD * _SK_MEM_PACKETS)
 #define SK_RMEM_MAX(_SK_MEM_OVERHEAD * _SK_MEM_PACKETS)
 
-extern __u32 sysctl_wmem_max;
-extern __u32 sysctl_rmem_max;
-
 extern int sysctl_tstamp_allow_data;
 extern int sysctl_optmem_max;
 
diff --git a/net/core/filter.c b/net/core/filter.c
index 255aeee72402..3dca58f6c40c 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4717,13 +4717,13 @@ static int _bpf_setsockopt(struct sock *sk, int level, 
int optname,
/* Only some socketops are supported */
switch (optname) {
case SO_RCVBUF:
-   val = min_t(u32, val, sysctl_rmem_max);
+   val = min_t(u32, val, 
sock_net(sk)->core.sysctl_rmem_max);
sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
WRITE_ONCE(sk->sk_rcvbuf,
   max_t(int, val * 2, SOCK_MIN_RCVBUF));
break;
case SO_SNDBUF:
-   val = min_t(u32, val, sysctl_wmem_max);
+   val = min_t(u32, val, 
sock_net(sk)->core.sysctl_wmem_max);
sk->sk_userlocks |= SOCK_SNDBUF_LOCK;
WRITE_ONCE(sk->sk_sndbuf,
   max_t(int, val * 2, SOCK_MIN_SNDBUF));
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index eb4ea99131d6..552e3c5b2a41 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -376,6 +376,8 @@ static int __net_init net_defaults_init_net(struct net *net)
 {
net->core.sysctl_rmem_default = SK_RMEM_MAX;
net->core.sysctl_wmem_default = SK_WMEM_MAX;
+   net->core.sysctl_rmem_max = SK_RMEM_MAX;
+   net->core.sysctl_wmem_max = SK_WMEM_MAX;
net->core.sysctl_somaxconn = SOMAXCONN;
return 0;
 }
diff --git a/net/core/sock.c b/net/core/sock.c
index 2421e4ea1915..eb7eaaa840ce 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -265,12 +265,6 @@ static struct lock_class_key af_wlock_keys[AF_MAX];
 static struct lock_class_key af_elock_keys[AF_MAX];
 static struct lock_class_key af_kern_callback_keys[AF_MAX];
 
-/* Run time adjustable parameters. */
-__u32 sysctl_wmem_max __read_mostly = SK_WMEM_MAX;
-EXPORT_SYMBOL(sysctl_wmem_max);
-__u32 sysctl_rmem_max __read_mostly = SK_RMEM_MAX;
-EXPORT_SYMBOL(sysctl_rmem_max);
-
 /* Maximal space eaten by iovec or ancillary data plus some space */
 int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512);
 EXPORT_SYMBOL(sysctl_optmem_max);
@@ -877,7 +871,7 @@ int sock_setsockopt(struct socket *sock, int level, int 
optname,
 * play 'guess the biggest size' games. RCVBUF/SNDBUF
 * are treated in BSD as hints
 */
-   val = min_t(u32, val, sysctl_wmem_max);
+   val = min_t(u32, val, sock_net(sk)->core.sysctl_wmem_max);
 set_sndbuf:
/* Ensure val * 2 fits into an int, to prevent max_t()
 * from treating it as a negative value.
@@ -909,7 +903,9 @@ int sock_setsockopt(struct socket *sock, int level, int 
optname,
 * play 'guess the biggest size' games. RCVBUF/SNDBUF
 * are treated in BSD as hints
 */
-   __sock_set_rcvbuf(sk, min_t(u32, val, sysctl_rmem_max));
+   __sock_set_rcvbuf(sk,
+ min_t(u32, val,
+   sock_net(sk)->core.sysctl_rmem_max));
break;
 
case SO_RCVBUFFORCE:
diff 

[PATCH net-next] net: core: Namespace-ify sysctl_wmem_default and sysctl_rmem_default

2021-01-17 Thread menglong8 . dong
From: Menglong Dong 

For now, sysctl_wmem_default and sysctl_rmem_default are globally
unified. It's not convenient in some case. For example, when we
use docker and try to control the default udp socket receive buffer
for each container.

For that reason, make sysctl_wmem_default and sysctl_rmem_default
per-namespace.

Signed-off-by: Menglong Dong 
---
 include/net/netns/core.h   |  2 ++
 include/net/sock.h |  3 ---
 net/core/net_namespace.c   |  2 ++
 net/core/sock.c|  6 ++
 net/core/sysctl_net_core.c | 32 
 net/ipv4/ip_output.c   |  2 +-
 6 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/include/net/netns/core.h b/include/net/netns/core.h
index 36c2d998a43c..317b47df6d08 100644
--- a/include/net/netns/core.h
+++ b/include/net/netns/core.h
@@ -9,6 +9,8 @@ struct netns_core {
/* core sysctls */
struct ctl_table_header *sysctl_hdr;
 
+   int sysctl_wmem_default;
+   int sysctl_rmem_default;
int sysctl_somaxconn;
 
 #ifdef CONFIG_PROC_FS
diff --git a/include/net/sock.h b/include/net/sock.h
index bdc4323ce53c..b846a6d24459 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2653,9 +2653,6 @@ extern __u32 sysctl_rmem_max;
 extern int sysctl_tstamp_allow_data;
 extern int sysctl_optmem_max;
 
-extern __u32 sysctl_wmem_default;
-extern __u32 sysctl_rmem_default;
-
 DECLARE_STATIC_KEY_FALSE(net_high_order_alloc_disable_key);
 
 static inline int sk_get_wmem0(const struct sock *sk, const struct proto 
*proto)
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 2ef3b4557f40..eb4ea99131d6 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -374,6 +374,8 @@ static __net_init int setup_net(struct net *net, struct 
user_namespace *user_ns)
 
 static int __net_init net_defaults_init_net(struct net *net)
 {
+   net->core.sysctl_rmem_default = SK_RMEM_MAX;
+   net->core.sysctl_wmem_default = SK_WMEM_MAX;
net->core.sysctl_somaxconn = SOMAXCONN;
return 0;
 }
diff --git a/net/core/sock.c b/net/core/sock.c
index bbcd4b97eddd..2421e4ea1915 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -270,8 +270,6 @@ __u32 sysctl_wmem_max __read_mostly = SK_WMEM_MAX;
 EXPORT_SYMBOL(sysctl_wmem_max);
 __u32 sysctl_rmem_max __read_mostly = SK_RMEM_MAX;
 EXPORT_SYMBOL(sysctl_rmem_max);
-__u32 sysctl_wmem_default __read_mostly = SK_WMEM_MAX;
-__u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX;
 
 /* Maximal space eaten by iovec or ancillary data plus some space */
 int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512);
@@ -2970,8 +2968,8 @@ void sock_init_data(struct socket *sock, struct sock *sk)
timer_setup(>sk_timer, NULL, 0);
 
sk->sk_allocation   =   GFP_KERNEL;
-   sk->sk_rcvbuf   =   sysctl_rmem_default;
-   sk->sk_sndbuf   =   sysctl_wmem_default;
+   sk->sk_rcvbuf   =   sock_net(sk)->core.sysctl_rmem_default;
+   sk->sk_sndbuf   =   sock_net(sk)->core.sysctl_wmem_default;
sk->sk_state=   TCP_CLOSE;
sk_set_socket(sk, sock);
 
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 966d976dee84..5c1c75e42a09 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -326,22 +326,6 @@ static struct ctl_table net_core_table[] = {
.proc_handler   = proc_dointvec_minmax,
.extra1 = _rcvbuf,
},
-   {
-   .procname   = "wmem_default",
-   .data   = _wmem_default,
-   .maxlen = sizeof(int),
-   .mode   = 0644,
-   .proc_handler   = proc_dointvec_minmax,
-   .extra1 = _sndbuf,
-   },
-   {
-   .procname   = "rmem_default",
-   .data   = _rmem_default,
-   .maxlen = sizeof(int),
-   .mode   = 0644,
-   .proc_handler   = proc_dointvec_minmax,
-   .extra1 = _rcvbuf,
-   },
{
.procname   = "dev_weight",
.data   = _p,
@@ -584,6 +568,22 @@ static struct ctl_table netns_core_table[] = {
.extra1 = SYSCTL_ZERO,
.proc_handler   = proc_dointvec_minmax
},
+   {
+   .procname   = "wmem_default",
+   .data   = _net.core.sysctl_wmem_default,
+   .maxlen = sizeof(int),
+   .mode   = 0644,
+   .proc_handler   = proc_dointvec_minmax,
+   .extra1 = _sndbuf,
+   },
+   {
+   .procname   = "rmem_default",
+   .data   = _net.core.sysctl_rmem_default,
+   .maxlen = sizeof(int),
+   .mode   = 0644,
+   .proc_handler   = 

[PATCH net-next] net: core: init every ctl_table in netns_core_table

2021-01-17 Thread menglong8 . dong
From: Menglong Dong 

For now, there is only one element in netns_core_table, and it is inited
directly in sysctl_core_net_init. To make it more flexible, we can init
every element at once, just like what ipv4_sysctl_init_net() did.

Signed-off-by: Menglong Dong 
---
 net/core/sysctl_net_core.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index d86d8d11cfe4..966d976dee84 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -606,15 +606,19 @@ static __net_init int sysctl_core_net_init(struct net 
*net)
 
tbl = netns_core_table;
if (!net_eq(net, _net)) {
+   int i;
+
tbl = kmemdup(tbl, sizeof(netns_core_table), GFP_KERNEL);
if (tbl == NULL)
goto err_dup;
 
-   tbl[0].data = >core.sysctl_somaxconn;
+   /* Update the variables to point into the current struct net */
+   for (i = 0; i < ARRAY_SIZE(netns_core_table) - 1; i++) {
+   tbl[i].data += (void *)net - (void *)_net;
 
-   /* Don't export any sysctls to unprivileged users */
-   if (net->user_ns != _user_ns) {
-   tbl[0].procname = NULL;
+   /* Don't export any sysctls to unprivileged users */
+   if (net->user_ns != _user_ns)
+   tbl[i].procname = NULL;
}
}
 
-- 
2.30.0



[PATCH v4 net-next] net: bridge: check vlan with eth_type_vlan() method

2021-01-17 Thread menglong8 . dong
From: Menglong Dong 

Replace some checks for ETH_P_8021Q and ETH_P_8021AD with
eth_type_vlan().

Signed-off-by: Menglong Dong 
---
v4:
- remove unnecessary brackets.

v3:
- fix compile warning in br_vlan_set_proto() by casting 'val' to
  be16.

v2:
- use eth_type_vlan() in br_validate() and __br_vlan_set_proto()
  too.
---
 net/bridge/br_forward.c |  3 +--
 net/bridge/br_netlink.c | 12 +++-
 net/bridge/br_vlan.c|  2 +-
 3 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index e28ffadd1371..6e9b049ae521 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -39,8 +39,7 @@ int br_dev_queue_push_xmit(struct net *net, struct sock *sk, 
struct sk_buff *skb
br_drop_fake_rtable(skb);
 
if (skb->ip_summed == CHECKSUM_PARTIAL &&
-   (skb->protocol == htons(ETH_P_8021Q) ||
-skb->protocol == htons(ETH_P_8021AD))) {
+   eth_type_vlan(skb->protocol)) {
int depth;
 
if (!__vlan_get_protocol(skb, skb->protocol, ))
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 49700ce0e919..762f273802cd 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -1096,15 +1096,9 @@ static int br_validate(struct nlattr *tb[], struct 
nlattr *data[],
return 0;
 
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
-   if (data[IFLA_BR_VLAN_PROTOCOL]) {
-   switch (nla_get_be16(data[IFLA_BR_VLAN_PROTOCOL])) {
-   case htons(ETH_P_8021Q):
-   case htons(ETH_P_8021AD):
-   break;
-   default:
-   return -EPROTONOSUPPORT;
-   }
-   }
+   if (data[IFLA_BR_VLAN_PROTOCOL] &&
+   !eth_type_vlan(nla_get_be16(data[IFLA_BR_VLAN_PROTOCOL])))
+   return -EPROTONOSUPPORT;
 
if (data[IFLA_BR_VLAN_DEFAULT_PVID]) {
__u16 defpvid = nla_get_u16(data[IFLA_BR_VLAN_DEFAULT_PVID]);
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 701cad646b20..bb2909738518 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -917,7 +917,7 @@ int __br_vlan_set_proto(struct net_bridge *br, __be16 proto)
 
 int br_vlan_set_proto(struct net_bridge *br, unsigned long val)
 {
-   if (val != ETH_P_8021Q && val != ETH_P_8021AD)
+   if (!eth_type_vlan(htons(val)))
return -EPROTONOSUPPORT;
 
return __br_vlan_set_proto(br, htons(val));
-- 
2.30.0



[PATCH v3 net-next] net: bridge: check vlan with eth_type_vlan() method

2021-01-14 Thread menglong8 . dong
From: Menglong Dong 

Replace some checks for ETH_P_8021Q and ETH_P_8021AD with
eth_type_vlan().

Signed-off-by: Menglong Dong 
---
v3:
- fix compile warning in br_vlan_set_proto() by casting 'val' to
  be16.

v2:
- use eth_type_vlan() in br_validate() and __br_vlan_set_proto()
  too.
---
 net/bridge/br_forward.c |  3 +--
 net/bridge/br_netlink.c | 11 +++
 net/bridge/br_vlan.c|  2 +-
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index e28ffadd1371..6e9b049ae521 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -39,8 +39,7 @@ int br_dev_queue_push_xmit(struct net *net, struct sock *sk, 
struct sk_buff *skb
br_drop_fake_rtable(skb);
 
if (skb->ip_summed == CHECKSUM_PARTIAL &&
-   (skb->protocol == htons(ETH_P_8021Q) ||
-skb->protocol == htons(ETH_P_8021AD))) {
+   eth_type_vlan(skb->protocol)) {
int depth;
 
if (!__vlan_get_protocol(skb, skb->protocol, ))
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 49700ce0e919..15cfcad846c5 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -1096,14 +1096,9 @@ static int br_validate(struct nlattr *tb[], struct 
nlattr *data[],
return 0;
 
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
-   if (data[IFLA_BR_VLAN_PROTOCOL]) {
-   switch (nla_get_be16(data[IFLA_BR_VLAN_PROTOCOL])) {
-   case htons(ETH_P_8021Q):
-   case htons(ETH_P_8021AD):
-   break;
-   default:
-   return -EPROTONOSUPPORT;
-   }
+   if (data[IFLA_BR_VLAN_PROTOCOL] &&
+   !eth_type_vlan(nla_get_be16(data[IFLA_BR_VLAN_PROTOCOL]))) {
+   return -EPROTONOSUPPORT;
}
 
if (data[IFLA_BR_VLAN_DEFAULT_PVID]) {
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 701cad646b20..bb2909738518 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -917,7 +917,7 @@ int __br_vlan_set_proto(struct net_bridge *br, __be16 proto)
 
 int br_vlan_set_proto(struct net_bridge *br, unsigned long val)
 {
-   if (val != ETH_P_8021Q && val != ETH_P_8021AD)
+   if (!eth_type_vlan(htons(val)))
return -EPROTONOSUPPORT;
 
return __br_vlan_set_proto(br, htons(val));
-- 
2.25.1



[PATCH v2] pata_rb532_cf: remove redundant error print in probe() method

2021-01-14 Thread menglong8 . dong
From: Menglong Dong 

Coccinelle reports a redundant error print in rb532_pata_driver_probe.
As 'platform_get_irq' already prints the error message, error print
here is redundant and can be removed.

Signed-off-by: Menglong Dong 
---
v2:
- change patch summary.
---
 drivers/ata/pata_rb532_cf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c
index 479c4b29b856..dcde84f571c4 100644
--- a/drivers/ata/pata_rb532_cf.c
+++ b/drivers/ata/pata_rb532_cf.c
@@ -115,10 +115,8 @@ static int rb532_pata_driver_probe(struct platform_device 
*pdev)
}
 
irq = platform_get_irq(pdev, 0);
-   if (irq <= 0) {
-   dev_err(>dev, "no IRQ resource found\n");
+   if (irq <= 0)
return -ENOENT;
-   }
 
gpiod = devm_gpiod_get(>dev, NULL, GPIOD_IN);
if (IS_ERR(gpiod)) {
-- 
2.25.1



[PATCH v2 net-next] net: tap: check vlan with eth_type_vlan() method

2021-01-14 Thread menglong8 . dong
From: Menglong Dong 

Replace some checks for ETH_P_8021Q and ETH_P_8021AD in
drivers/net/tap.c with eth_type_vlan.

Signed-off-by: Menglong Dong 
---
v2:
- use eth_type_vlan() in tap_get_user_xdp() too.
---
 drivers/net/tap.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index 3c652c8ac5ba..ff4aa35979a1 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -713,8 +713,7 @@ static ssize_t tap_get_user(struct tap_queue *q, void 
*msg_control,
skb_probe_transport_header(skb);
 
/* Move network header to the right position for VLAN tagged packets */
-   if ((skb->protocol == htons(ETH_P_8021Q) ||
-skb->protocol == htons(ETH_P_8021AD)) &&
+   if (eth_type_vlan(skb->protocol) &&
__vlan_get_protocol(skb, skb->protocol, ) != 0)
skb_set_network_header(skb, depth);
 
@@ -1164,8 +1163,7 @@ static int tap_get_user_xdp(struct tap_queue *q, struct 
xdp_buff *xdp)
}
 
/* Move network header to the right position for VLAN tagged packets */
-   if ((skb->protocol == htons(ETH_P_8021Q) ||
-skb->protocol == htons(ETH_P_8021AD)) &&
+   if (eth_type_vlan(skb->protocol) &&
__vlan_get_protocol(skb, skb->protocol, ) != 0)
skb_set_network_header(skb, depth);
 
-- 
2.25.1



[PATCH v2 net-next] net: bridge: check vlan with eth_type_vlan() method

2021-01-14 Thread menglong8 . dong
From: Menglong Dong 

Replace some checks for ETH_P_8021Q and ETH_P_8021AD with
eth_type_vlan().

Signed-off-by: Menglong Dong 
---
v2:
- use eth_type_vlan() in br_validate() and __br_vlan_set_proto()
  too.
---
 net/bridge/br_forward.c |  3 +--
 net/bridge/br_netlink.c | 11 +++
 net/bridge/br_vlan.c|  2 +-
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index e28ffadd1371..6e9b049ae521 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -39,8 +39,7 @@ int br_dev_queue_push_xmit(struct net *net, struct sock *sk, 
struct sk_buff *skb
br_drop_fake_rtable(skb);
 
if (skb->ip_summed == CHECKSUM_PARTIAL &&
-   (skb->protocol == htons(ETH_P_8021Q) ||
-skb->protocol == htons(ETH_P_8021AD))) {
+   eth_type_vlan(skb->protocol)) {
int depth;
 
if (!__vlan_get_protocol(skb, skb->protocol, ))
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 49700ce0e919..15cfcad846c5 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -1096,14 +1096,9 @@ static int br_validate(struct nlattr *tb[], struct 
nlattr *data[],
return 0;
 
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
-   if (data[IFLA_BR_VLAN_PROTOCOL]) {
-   switch (nla_get_be16(data[IFLA_BR_VLAN_PROTOCOL])) {
-   case htons(ETH_P_8021Q):
-   case htons(ETH_P_8021AD):
-   break;
-   default:
-   return -EPROTONOSUPPORT;
-   }
+   if (data[IFLA_BR_VLAN_PROTOCOL] &&
+   !eth_type_vlan(nla_get_be16(data[IFLA_BR_VLAN_PROTOCOL]))) {
+   return -EPROTONOSUPPORT;
}
 
if (data[IFLA_BR_VLAN_DEFAULT_PVID]) {
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 701cad646b20..24660fe33545 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -917,7 +917,7 @@ int __br_vlan_set_proto(struct net_bridge *br, __be16 proto)
 
 int br_vlan_set_proto(struct net_bridge *br, unsigned long val)
 {
-   if (val != ETH_P_8021Q && val != ETH_P_8021AD)
+   if (!eth_type_vlan(val))
return -EPROTONOSUPPORT;
 
return __br_vlan_set_proto(br, htons(val));
-- 
2.25.1



[PATCH net-next] net: bridge: use eth_type_vlan in br_dev_queue_push_xmit

2021-01-13 Thread menglong8 . dong
From: Menglong Dong 

Replace the check for ETH_P_8021Q and ETH_P_8021AD in
br_dev_queue_push_xmit with eth_type_vlan.

Signed-off-by: Menglong Dong 
---
 net/bridge/br_forward.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index e28ffadd1371..6e9b049ae521 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -39,8 +39,7 @@ int br_dev_queue_push_xmit(struct net *net, struct sock *sk, 
struct sk_buff *skb
br_drop_fake_rtable(skb);
 
if (skb->ip_summed == CHECKSUM_PARTIAL &&
-   (skb->protocol == htons(ETH_P_8021Q) ||
-skb->protocol == htons(ETH_P_8021AD))) {
+   eth_type_vlan(skb->protocol)) {
int depth;
 
if (!__vlan_get_protocol(skb, skb->protocol, ))
-- 
2.25.1



[PATCH net-next] net: core: use eth_type_vlan in tap_get_user_xdp

2021-01-13 Thread menglong8 . dong
From: Menglong Dong 

Replace the check for ETH_P_8021Q and ETH_P_8021AD in
tap_get_user_xdp with eth_type_vlan.

Signed-off-by: Menglong Dong 
---
 drivers/net/tap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index 3c652c8ac5ba..e007583b5bd1 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -1164,8 +1164,7 @@ static int tap_get_user_xdp(struct tap_queue *q, struct 
xdp_buff *xdp)
}
 
/* Move network header to the right position for VLAN tagged packets */
-   if ((skb->protocol == htons(ETH_P_8021Q) ||
-skb->protocol == htons(ETH_P_8021AD)) &&
+   if (eth_type_vlan(skb->protocol) &&
__vlan_get_protocol(skb, skb->protocol, ) != 0)
skb_set_network_header(skb, depth);
 
-- 
2.25.1



[PATCH net-next] net: tap: use eth_type_vlan in tap_get_user

2021-01-13 Thread menglong8 . dong
From: Menglong Dong 

Replace the check for ETH_P_8021Q and ETH_P_8021AD in
tap_get_user with eth_type_vlan.

Signed-off-by: Menglong Dong 
---
 drivers/net/tap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index 3c652c8ac5ba..cf9197fe3bb6 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -713,8 +713,7 @@ static ssize_t tap_get_user(struct tap_queue *q, void 
*msg_control,
skb_probe_transport_header(skb);
 
/* Move network header to the right position for VLAN tagged packets */
-   if ((skb->protocol == htons(ETH_P_8021Q) ||
-skb->protocol == htons(ETH_P_8021AD)) &&
+   if (eth_type_vlan(skb->protocol) &&
__vlan_get_protocol(skb, skb->protocol, ) != 0)
skb_set_network_header(skb, depth);
 
-- 
2.25.1



[PATCH v2] edac: remove redundant error print in xgene_edac_probe

2021-01-12 Thread menglong8 . dong
From: Menglong Dong 

Coccinelle reports a redundant error print in xgene_edac_probe.
As 'platform_get_irq' already prints the error message, error
print here is redundant.

Fix it by using 'platform_get_irq_optional' in place of
'platform_get_irq', as Robert suggested.

Signed-off-by: Menglong Dong 
---
v2:
- use 'platform_get_irq_optional' instead of 'platform_get_irq'
---
 drivers/edac/xgene_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/xgene_edac.c b/drivers/edac/xgene_edac.c
index 1d2c27a00a4a..2ccd1db5e98f 100644
--- a/drivers/edac/xgene_edac.c
+++ b/drivers/edac/xgene_edac.c
@@ -1916,7 +1916,7 @@ static int xgene_edac_probe(struct platform_device *pdev)
int i;
 
for (i = 0; i < 3; i++) {
-   irq = platform_get_irq(pdev, i);
+   irq = platform_get_irq_optional(pdev, i);
if (irq < 0) {
dev_err(>dev, "No IRQ resource\n");
rc = -EINVAL;
-- 
2.17.1



[PATCH] fs: cifs: remove unneeded variable in smb3_fs_context_dup

2021-01-12 Thread menglong8 . dong
From: Menglong Dong 

'rc' in smb3_fs_context_dup is not used and can be removed.

Signed-off-by: Menglong Dong 
---
 fs/cifs/fs_context.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c
index 0afccbbed2e6..076bcadc756a 100644
--- a/fs/cifs/fs_context.c
+++ b/fs/cifs/fs_context.c
@@ -303,8 +303,6 @@ do {
\
 int
 smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context 
*ctx)
 {
-   int rc = 0;
-
memcpy(new_ctx, ctx, sizeof(*ctx));
new_ctx->prepath = NULL;
new_ctx->mount_options = NULL;
@@ -327,7 +325,7 @@ smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct 
smb3_fs_context *ctx
DUP_CTX_STR(nodename);
DUP_CTX_STR(iocharset);
 
-   return rc;
+   return 0;
 }
 
 static int
-- 
2.17.1



[PATCH] i2c: remove redundant error print in stm32f7_i2c_probe

2021-01-12 Thread menglong8 . dong
From: Menglong Dong 

Coccinelle reports a redundant error print in stm32f7_i2c_probe.
As 'platform_get_irq' already prints the error message, error
print here is redundant and can be removed.

Signed-off-by: Menglong Dong 
---
 drivers/i2c/busses/i2c-stm32f7.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index 9aa8e65b511e..adba496e1e31 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -2026,12 +2026,8 @@ static int stm32f7_i2c_probe(struct platform_device 
*pdev)
}
 
irq_error = platform_get_irq(pdev, 1);
-   if (irq_error <= 0) {
-   if (irq_error != -EPROBE_DEFER)
-   dev_err(>dev, "Failed to get IRQ error: %d\n",
-   irq_error);
+   if (irq_error <= 0)
return irq_error ? : -ENOENT;
-   }
 
i2c_dev->wakeup_src = of_property_read_bool(pdev->dev.of_node,
"wakeup-source");
-- 
2.17.1



[PATCH] edac: remove redundant error print in xgene_edac_probe

2021-01-12 Thread menglong8 . dong
From: Menglong Dong 

Coccinelle reports a redundant error print in xgene_edac_probe.
As 'platform_get_irq' already prints the error message, error
print here is redundant and can be removed.

Signed-off-by: Menglong Dong 
---
 drivers/edac/xgene_edac.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/edac/xgene_edac.c b/drivers/edac/xgene_edac.c
index 1d2c27a00a4a..1d583f0ea4dc 100644
--- a/drivers/edac/xgene_edac.c
+++ b/drivers/edac/xgene_edac.c
@@ -1918,7 +1918,6 @@ static int xgene_edac_probe(struct platform_device *pdev)
for (i = 0; i < 3; i++) {
irq = platform_get_irq(pdev, i);
if (irq < 0) {
-   dev_err(>dev, "No IRQ resource\n");
rc = -EINVAL;
goto out_err;
}
-- 
2.17.1



[PATCH v2] csky: kprobe: fix unreachable code in simulate_blz32

2021-01-11 Thread menglong8 . dong
From: Menglong Dong 

The type of 'val' is 'unsigned long' in simulate_blz32, so 'val < 0'
can't be true.

Cast 'val' to 'long' here to determine branch token or not,
as Guo Ren suggested.

Fixes: 33e53ae1ce41 ("csky: Add kprobes supported")
Signed-off-by: Menglong Dong 
---
v2:
- Cast 'val' to 'long'.
---
 arch/csky/kernel/probes/simulate-insn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/csky/kernel/probes/simulate-insn.c 
b/arch/csky/kernel/probes/simulate-insn.c
index 4e464fed52ec..9ad771c47670 100644
--- a/arch/csky/kernel/probes/simulate-insn.c
+++ b/arch/csky/kernel/probes/simulate-insn.c
@@ -348,7 +348,7 @@ simulate_blz32(u32 opcode, long addr, struct pt_regs *regs)
 
csky_insn_reg_get_val(regs, tmp, );
 
-   if (val < 0) {
+   if ((long)val < 0) {
instruction_pointer_set(regs,
addr + sign_extend32((opcode & 0x) >> 15, 15));
} else
-- 
2.17.1



[PATCH] ata: remove redundant error print in rb532_pata_driver_probe

2021-01-11 Thread menglong8 . dong
From: Menglong Dong 

Coccinelle reports a redundant error print in rb532_pata_driver_probe.
As 'platform_get_irq' already prints the error message, error print
here is redundant and can be removed.

Signed-off-by: Menglong Dong 
---
 drivers/ata/pata_rb532_cf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c
index 479c4b29b856..dcde84f571c4 100644
--- a/drivers/ata/pata_rb532_cf.c
+++ b/drivers/ata/pata_rb532_cf.c
@@ -115,10 +115,8 @@ static int rb532_pata_driver_probe(struct platform_device 
*pdev)
}
 
irq = platform_get_irq(pdev, 0);
-   if (irq <= 0) {
-   dev_err(>dev, "no IRQ resource found\n");
+   if (irq <= 0)
return -ENOENT;
-   }
 
gpiod = devm_gpiod_get(>dev, NULL, GPIOD_IN);
if (IS_ERR(gpiod)) {
-- 
2.17.1



[PATCH] power: supply: remove duplicated argument in power_supply_hwmon_info

2021-01-11 Thread menglong8 . dong
From: Menglong Dong 

'HWMON_T_INPUT' and 'HWMON_T_MIN_ALARM' in power_supply_hwmon_info are
duplicated and can be removed.

Signed-off-by: Menglong Dong 
---
 drivers/power/supply/power_supply_hwmon.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/power/supply/power_supply_hwmon.c 
b/drivers/power/supply/power_supply_hwmon.c
index 7fe4b6b6ddc8..bffe6d84c429 100644
--- a/drivers/power/supply/power_supply_hwmon.c
+++ b/drivers/power/supply/power_supply_hwmon.c
@@ -299,13 +299,11 @@ static const struct hwmon_channel_info 
*power_supply_hwmon_info[] = {
   HWMON_T_INPUT |
   HWMON_T_MAX   |
   HWMON_T_MIN   |
-  HWMON_T_MIN_ALARM |
   HWMON_T_MIN_ALARM,
 
   HWMON_T_LABEL |
   HWMON_T_INPUT |
   HWMON_T_MIN_ALARM |
-  HWMON_T_LABEL |
   HWMON_T_MAX_ALARM),
 
HWMON_CHANNEL_INFO(curr,
-- 
2.17.1



[PATCH] csky: kprobe: fix unreachable code in simulate_blz32

2021-01-11 Thread menglong8 . dong
From: Menglong Dong 

The type of 'val' is 'unsigned long' in simulate_blz32, so 'val < 0'
can't be true.

When 'csky_insn_reg_get_val' fails, 'false' will be returned. We
can directly use its return value here.

Fixes: 33e53ae1ce41 ("csky: Add kprobes supported")
Signed-off-by: Menglong Dong 
---
 arch/csky/kernel/probes/simulate-insn.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/csky/kernel/probes/simulate-insn.c 
b/arch/csky/kernel/probes/simulate-insn.c
index 4e464fed52ec..b09ddcbcfa18 100644
--- a/arch/csky/kernel/probes/simulate-insn.c
+++ b/arch/csky/kernel/probes/simulate-insn.c
@@ -346,9 +346,7 @@ simulate_blz32(u32 opcode, long addr, struct pt_regs *regs)
unsigned long tmp = opcode & 0x1f;
unsigned long val;
 
-   csky_insn_reg_get_val(regs, tmp, );
-
-   if (val < 0) {
+   if (!csky_insn_reg_get_val(regs, tmp, )) {
instruction_pointer_set(regs,
addr + sign_extend32((opcode & 0x) >> 15, 15));
} else
-- 
2.17.1



[PATCH v2] MIPS: OCTEON: fix unreachable code in octeon_irq_init_ciu

2021-01-11 Thread menglong8 . dong
From: Menglong Dong 

The type of 'r' in octeon_irq_init_ciu is 'unsigned int', so 'r < 0'
can't be true.

Fix this by change the type of 'r' and 'i' from 'unsigned int'
to 'int'. As 'i' won't be negative, this change works.

Fixes: 99fbc70f8547 ("MIPS: Octeon: irq: Alloc desc before configuring IRQ")
Signed-off-by: Menglong Dong 
Reviewed-by: Alexander Sverdlin 
---
v2:
- change 'Fixes' from 64b139f97c01 to 99fbc70f8547
---
 arch/mips/cavium-octeon/octeon-irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/cavium-octeon/octeon-irq.c 
b/arch/mips/cavium-octeon/octeon-irq.c
index bd47e15d02c7..be5d4afcd30f 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -1444,7 +1444,7 @@ static void octeon_irq_setup_secondary_ciu2(void)
 static int __init octeon_irq_init_ciu(
struct device_node *ciu_node, struct device_node *parent)
 {
-   unsigned int i, r;
+   int i, r;
struct irq_chip *chip;
struct irq_chip *chip_edge;
struct irq_chip *chip_mbox;
-- 
2.17.1



[PATCH] MIPS: OCTEON: fix unreachable code in octeon_irq_init_ciu

2021-01-11 Thread menglong8 . dong
From: Menglong Dong 

The type of 'r' in octeon_irq_init_ciu is 'unsigned int', so 'r < 0'
can't be true.

Fix this by change the type of 'r' and 'i' from 'unsigned int'
to 'int'. As 'i' won't be negative, this change works.

Fixes: 64b139f97c01("MIPS: OCTEON: irq: add CIB and other fixes")
Signed-off-by: Menglong Dong 
---
 arch/mips/cavium-octeon/octeon-irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/cavium-octeon/octeon-irq.c 
b/arch/mips/cavium-octeon/octeon-irq.c
index bd47e15d02c7..be5d4afcd30f 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -1444,7 +1444,7 @@ static void octeon_irq_setup_secondary_ciu2(void)
 static int __init octeon_irq_init_ciu(
struct device_node *ciu_node, struct device_node *parent)
 {
-   unsigned int i, r;
+   int i, r;
struct irq_chip *chip;
struct irq_chip *chip_edge;
struct irq_chip *chip_mbox;
-- 
2.17.1



[PATCH net-next] net: core: use eth_type_vlan in __netif_receive_skb_core

2021-01-11 Thread menglong8 . dong
From: Menglong Dong 

Replace the check for ETH_P_8021Q and ETH_P_8021AD in
__netif_receive_skb_core with eth_type_vlan.

Signed-off-by: Menglong Dong 
---
 net/core/dev.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index e4d77c8abe76..267c4a8daa55 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5151,8 +5151,7 @@ static int __netif_receive_skb_core(struct sk_buff 
**pskb, bool pfmemalloc,
skb_reset_mac_len(skb);
}
 
-   if (skb->protocol == cpu_to_be16(ETH_P_8021Q) ||
-   skb->protocol == cpu_to_be16(ETH_P_8021AD)) {
+   if (eth_type_vlan(skb->protocol)) {
skb = skb_vlan_untag(skb);
if (unlikely(!skb))
goto out;
@@ -5236,8 +5235,7 @@ static int __netif_receive_skb_core(struct sk_buff 
**pskb, bool pfmemalloc,
 * find vlan device.
 */
skb->pkt_type = PACKET_OTHERHOST;
-   } else if (skb->protocol == cpu_to_be16(ETH_P_8021Q) ||
-  skb->protocol == cpu_to_be16(ETH_P_8021AD)) {
+   } else if (eth_type_vlan(skb->protocol)) {
/* Outer header is 802.1P with vlan 0, inner header is
 * 802.1Q or 802.1AD and vlan_do_receive() above could
 * not find vlan dev for vlan id 0.
-- 
2.17.1



[PATCH net-next] net/bridge: fix misspellings using codespell tool

2021-01-07 Thread menglong8 . dong
From: Menglong Dong 

Some typos are found out by codespell tool:

$ codespell ./net/bridge/
./net/bridge/br_stp.c:604: permanant  ==> permanent
./net/bridge/br_stp.c:605: persistance  ==> persistence
./net/bridge/br.c:125: underlaying  ==> underlying
./net/bridge/br_input.c:43: modue  ==> mode
./net/bridge/br_mrp.c:828: Determin  ==> Determine
./net/bridge/br_mrp.c:848: Determin  ==> Determine
./net/bridge/br_mrp.c:897: Determin  ==> Determine

Fix typos found by codespell.

Signed-off-by: Menglong Dong 
---
 net/bridge/br.c   | 2 +-
 net/bridge/br_input.c | 2 +-
 net/bridge/br_mrp.c   | 6 +++---
 net/bridge/br_stp.c   | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/bridge/br.c b/net/bridge/br.c
index 1b169f8e7491..ef743f94254d 100644
--- a/net/bridge/br.c
+++ b/net/bridge/br.c
@@ -122,7 +122,7 @@ static int br_device_event(struct notifier_block *unused, 
unsigned long event, v
break;
 
case NETDEV_PRE_TYPE_CHANGE:
-   /* Forbid underlaying device to change its type. */
+   /* Forbid underlying device to change its type. */
return NOTIFY_BAD;
 
case NETDEV_RESEND_IGMP:
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 8ca1f1bc6d12..85d9dae2 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -40,7 +40,7 @@ static int br_pass_frame_up(struct sk_buff *skb)
 
vg = br_vlan_group_rcu(br);
/* Bridge is just like any other port.  Make sure the
-* packet is allowed except in promisc modue when someone
+* packet is allowed except in promisc mode when someone
 * may be running packet capture.
 */
if (!(brdev->flags & IFF_PROMISC) &&
diff --git a/net/bridge/br_mrp.c b/net/bridge/br_mrp.c
index cec2c4e4561d..fc0a98874bfc 100644
--- a/net/bridge/br_mrp.c
+++ b/net/bridge/br_mrp.c
@@ -825,7 +825,7 @@ int br_mrp_start_in_test(struct net_bridge *br,
return 0;
 }
 
-/* Determin if the frame type is a ring frame */
+/* Determine if the frame type is a ring frame */
 static bool br_mrp_ring_frame(struct sk_buff *skb)
 {
const struct br_mrp_tlv_hdr *hdr;
@@ -845,7 +845,7 @@ static bool br_mrp_ring_frame(struct sk_buff *skb)
return false;
 }
 
-/* Determin if the frame type is an interconnect frame */
+/* Determine if the frame type is an interconnect frame */
 static bool br_mrp_in_frame(struct sk_buff *skb)
 {
const struct br_mrp_tlv_hdr *hdr;
@@ -894,7 +894,7 @@ static void br_mrp_mrm_process(struct br_mrp *mrp, struct 
net_bridge_port *port,
br_mrp_ring_port_open(port->dev, false);
 }
 
-/* Determin if the test hdr has a better priority than the node */
+/* Determine if the test hdr has a better priority than the node */
 static bool br_mrp_test_better_than_own(struct br_mrp *mrp,
struct net_bridge *br,
const struct br_mrp_ring_test_hdr *hdr)
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index 3e88be7aa269..a3a5745660dd 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -601,8 +601,8 @@ int __set_ageing_time(struct net_device *dev, unsigned long 
t)
 /* Set time interval that dynamic forwarding entries live
  * For pure software bridge, allow values outside the 802.1
  * standard specification for special cases:
- *  0 - entry never ages (all permanant)
- *  1 - entry disappears (no persistance)
+ *  0 - entry never ages (all permanent)
+ *  1 - entry disappears (no persistence)
  *
  * Offloaded switch entries maybe more restrictive
  */
-- 
2.25.1



[PATCH] selftests/bpf: remove duplicate include in test_lsm

2021-01-05 Thread menglong8 . dong
From: Menglong Dong 

'unistd.h' included in 'selftests/bpf/prog_tests/test_lsm.c' is
duplicated.

Signed-off-by: Menglong Dong 
---
 tools/testing/selftests/bpf/prog_tests/test_lsm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/test_lsm.c 
b/tools/testing/selftests/bpf/prog_tests/test_lsm.c
index 6ab29226c99b..2755e4f81499 100644
--- a/tools/testing/selftests/bpf/prog_tests/test_lsm.c
+++ b/tools/testing/selftests/bpf/prog_tests/test_lsm.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "lsm.skel.h"
 
-- 
2.17.1



[PATCH] coredump: fix core_pattern parse error

2020-11-19 Thread menglong8 . dong
From: Menglong Dong 

'format_corename()' will splite 'core_pattern' on spaces when it
is in pipe mode, and take helper_argv[0] as the path to usermode
executable.

It works fine in most cases. However, if there is a space between
'|' and '/file/path', such as
'| /usr/lib/systemd/systemd-coredump %P %u %g',
helper_argv[0] will be parsed as '', and users will get a
'Core dump to | disabled'.

It is not friendly to users, as the pattern above was valid previously.
Fix this by ignoring the spaces between '|' and '/file/path'.

Fixes: 315c69261dd3 ("coredump: split pipe command whitespace before expanding 
template")
Signed-off-by: Menglong Dong 
---
 fs/coredump.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 0cd9056d79cc..c6acfc694f65 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -229,7 +229,8 @@ static int format_corename(struct core_name *cn, struct 
coredump_params *cprm,
 */
if (ispipe) {
if (isspace(*pat_ptr)) {
-   was_space = true;
+   if (cn->used != 0)
+   was_space = true;
pat_ptr++;
continue;
} else if (was_space) {
-- 
2.25.1




  1   2   >