[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200818114132.17510-1-linmiaohe@huawei.com>
Date: Tue, 18 Aug 2020 07:41:32 -0400
From: Miaohe Lin <linmiaohe@...wei.com>
To: <davem@...emloft.net>, <kuba@...nel.org>, <edumazet@...gle.com>,
<kafai@...com>, <ast@...nel.org>, <jakub@...udflare.com>,
<zhang.lin16@....com.cn>, <keescook@...omium.org>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linmiaohe@...wei.com>
Subject: [PATCH] net: Avoid strcmp current->comm with warncomm when warned >= 5
We can possibly avoid strcmp warncomm with current->comm by check warned
first.
Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
net/core/sock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index e4f40b175acb..51e13bc42791 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -417,7 +417,7 @@ static void sock_warn_obsolete_bsdism(const char *name)
{
static int warned;
static char warncomm[TASK_COMM_LEN];
- if (strcmp(warncomm, current->comm) && warned < 5) {
+ if (warned < 5 && strcmp(warncomm, current->comm)) {
strcpy(warncomm, current->comm);
pr_warn("process `%s' is using obsolete %s SO_BSDCOMPAT\n",
warncomm, name);
--
2.19.1
Powered by blists - more mailing lists