* Re: [PATCH] net: Avoid strcmp current->comm with warncomm when warned >= 5
@ 2020-08-19 1:49 linmiaohe
0 siblings, 0 replies; 3+ messages in thread
From: linmiaohe @ 2020-08-19 1:49 UTC (permalink / raw)
To: David Miller
Cc: kuba, edumazet, kafai, ast, jakub, zhang.lin16, keescook, netdev,
linux-kernel
David Miller <davem@davemloft.net> wrote:
>From: Miaohe Lin <linmiaohe@huawei.com>
>Date: Tue, 18 Aug 2020 07:41:32 -0400
>
>> @@ -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);
>
>We've been warning about SO_BSDCOMPAT usage for almost 20 years, I think we can remove this code completely now.
Looks sane. Will do. Many thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: Avoid strcmp current->comm with warncomm when warned >= 5
2020-08-18 11:41 Miaohe Lin
@ 2020-08-18 19:45 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2020-08-18 19:45 UTC (permalink / raw)
To: linmiaohe
Cc: kuba, edumazet, kafai, ast, jakub, zhang.lin16, keescook, netdev,
linux-kernel
From: Miaohe Lin <linmiaohe@huawei.com>
Date: Tue, 18 Aug 2020 07:41:32 -0400
> @@ -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);
We've been warning about SO_BSDCOMPAT usage for almost 20 years, I think
we can remove this code completely now.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] net: Avoid strcmp current->comm with warncomm when warned >= 5
@ 2020-08-18 11:41 Miaohe Lin
2020-08-18 19:45 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Miaohe Lin @ 2020-08-18 11:41 UTC (permalink / raw)
To: davem, kuba, edumazet, kafai, ast, jakub, zhang.lin16, keescook
Cc: netdev, linux-kernel, linmiaohe
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-19 1:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 1:49 [PATCH] net: Avoid strcmp current->comm with warncomm when warned >= 5 linmiaohe
-- strict thread matches above, loose matches on Subject: below --
2020-08-18 11:41 Miaohe Lin
2020-08-18 19:45 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.