Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: <davem@davemloft.net>, <kuba@kernel.org>, <edumazet@google.com>,
	<kafai@fb.com>, <ast@kernel.org>, <jakub@cloudflare.com>,
	<zhang.lin16@zte.com.cn>, <keescook@chromium.org>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linmiaohe@huawei.com>
Subject: [PATCH] net: Avoid strcmp current->comm with warncomm when warned >= 5
Date: Tue, 18 Aug 2020 07:41:32 -0400	[thread overview]
Message-ID: <20200818114132.17510-1-linmiaohe@huawei.com> (raw)

We can possibly avoid strcmp warncomm with current->comm by check warned
first.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.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


             reply	other threads:[~2020-08-18 11:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18 11:41 Miaohe Lin [this message]
2020-08-18 19:45 ` David Miller
2020-08-19  1:49 linmiaohe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200818114132.17510-1-linmiaohe@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=ast@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jakub@cloudflare.com \
    --cc=kafai@fb.com \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=zhang.lin16@zte.com.cn \
    --subject='Re: [PATCH] net: Avoid strcmp current->comm with warncomm when warned >= 5' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).