diff mbox series

[net-next] net/trace: fix printk format in inet_sock_set_state

Message ID 1513957033-24100-1-git-send-email-laoar.shao@gmail.com
State Superseded, archived
Delegated to: David Miller
Headers show
Series [net-next] net/trace: fix printk format in inet_sock_set_state | expand

Commit Message

Yafang Shao Dec. 22, 2017, 3:37 p.m. UTC
There's a space character missed in the printk messages.
This error should be prevented with checkscript.pl, but it couldn't caught
by running with "checkscript.pl -f xxxx.patch", that's what I had run
before.
What a carelessness.

Fixes: 563e0bb0dc74("net: tracepoint: replace tcp_set_state tracepoint with
inet_sock_set_state tracepoint")
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 include/trace/events/sock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
1.8.3.1

Comments

Sergei Shtylyov Dec. 22, 2017, 5:04 p.m. UTC | #1
Hello!

On 12/22/2017 06:37 PM, Yafang Shao wrote:

> There's a space character missed in the printk messages.
> This error should be prevented with checkscript.pl, but it couldn't caught
                                                                      ^ be?

> by running with "checkscript.pl -f xxxx.patch", that's what I had run
> before.
> What a carelessness.

    You generally don't need to break up the messages violating 80-column 
limit, and checkpatch.pl should be aware of this...

> Fixes: 563e0bb0dc74("net: tracepoint: replace tcp_set_state tracepoint with
> inet_sock_set_state tracepoint")
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
[...]

MBR, Sergei
Yafang Shao Dec. 23, 2017, 1:10 a.m. UTC | #2
On Sat, Dec 23, 2017 at 1:04 AM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Hello!
>
> On 12/22/2017 06:37 PM, Yafang Shao wrote:
>
>> There's a space character missed in the printk messages.
>> This error should be prevented with checkscript.pl, but it couldn't caught
>
>                                                                      ^ be?

It is checkpatch.pl.

>
>> by running with "checkscript.pl -f xxxx.patch", that's what I had run
>> before.
>> What a carelessness.
>
>
>    You generally don't need to break up the messages violating 80-column
> limit, and checkpatch.pl should be aware of this...
>

Oh. That's right.
It can be aware of that.

I just want to make the code easy to read and limit the textwidth to
80 character.

If the message takes two lines as bellow,
    printk("xxx "
                     ^ space character.
              "yyy");
The checkpatch.pl  could also be aware of that if the first line is
not end with space character, but it couldn't be aware of that if run
with "checkpatch.pl -f xxxx.patch".


>> Fixes: 563e0bb0dc74("net: tracepoint: replace tcp_set_state tracepoint
>> with
>> inet_sock_set_state tracepoint")
>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
>
> [...]
>
> MBR, Sergei
Yafang Shao Dec. 23, 2017, 1:19 a.m. UTC | #3
On Sat, Dec 23, 2017 at 9:10 AM, Yafang Shao <laoar.shao@gmail.com> wrote:
> On Sat, Dec 23, 2017 at 1:04 AM, Sergei Shtylyov
> <sergei.shtylyov@cogentembedded.com> wrote:
>> Hello!
>>
>> On 12/22/2017 06:37 PM, Yafang Shao wrote:
>>
>>> There's a space character missed in the printk messages.
>>> This error should be prevented with checkscript.pl, but it couldn't caught
>>
>>                                                                      ^ be?
>
> It is checkpatch.pl.
>
>>
>>> by running with "checkscript.pl -f xxxx.patch", that's what I had run
>>> before.
>>> What a carelessness.
>>
>>
>>    You generally don't need to break up the messages violating 80-column
>> limit, and checkpatch.pl should be aware of this...
>>
>
> Oh. That's right.
> It can be aware of that.
>
> I just want to make the code easy to read and limit the textwidth to
> 80 character.
>
> If the message takes two lines as bellow,
>     printk("xxx "
>                      ^ space character.
>               "yyy");
> The checkpatch.pl  could also be aware of that if the first line is
> not end with space character, but it couldn't be aware of that if run
> with "checkpatch.pl -f xxxx.patch".
>

Should we need to check that error as well when we run with
"checkpatch.pl -f" ?

>
>>> Fixes: 563e0bb0dc74("net: tracepoint: replace tcp_set_state tracepoint
>>> with
>>> inet_sock_set_state tracepoint")
>>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
>>
>> [...]
>>
>> MBR, Sergei
Sergei Shtylyov Dec. 23, 2017, 9:42 a.m. UTC | #4
On 12/23/2017 4:10 AM, Yafang Shao wrote:

>>> There's a space character missed in the printk messages.
>>> This error should be prevented with checkscript.pl, but it couldn't caught

> It is checkpatch.pl.

    Yes, that too. But I actually meant you missed "be" between "couldn't" and 
"caught"...

>>> by running with "checkscript.pl -f xxxx.patch", that's what I had run
>>> before.
>>> What a carelessness.

>>     You generally don't need to break up the messages violating 80-column
>> limit, and checkpatch.pl should be aware of this...

> Oh. That's right.
> It can be aware of that.

    It is aware --- I'm just not sure it recognizes TP_printk() -- like it 
does recognize printk() fo that purpose.

> I just want to make the code easy to read and limit the textwidth to
> 80 character.

    Contrariwise, that's what you shouldn't do. Would simplify searching for 
the messages in the kernel source.

> If the message takes two lines as bellow,
>      printk("xxx "
>                       ^ space character.
>                "yyy");
> The checkpatch.pl  could also be aware of that if the first line is
> not end with space character, but it couldn't be aware of that if run
> with "checkpatch.pl -f xxxx.patch".

    Option -f tells checkpatch.pl that it should check a source file, not a 
patch. I don't know why you use that with the patches...

>>> Fixes: 563e0bb0dc74("net: tracepoint: replace tcp_set_state tracepoint
>>> with
>>> inet_sock_set_state tracepoint")
>>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>

[...]

MBR, Sergei
Yafang Shao Dec. 23, 2017, 1:08 p.m. UTC | #5
On Sat, Dec 23, 2017 at 5:42 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> On 12/23/2017 4:10 AM, Yafang Shao wrote:
>
>>>> There's a space character missed in the printk messages.
>>>> This error should be prevented with checkscript.pl, but it couldn't
>>>> caught
>
>
>> It is checkpatch.pl.
>
>
>    Yes, that too. But I actually meant you missed "be" between "couldn't"
> and "caught"...
>
>>>> by running with "checkscript.pl -f xxxx.patch", that's what I had run
>>>> before.
>>>> What a carelessness.
>
>
>>>     You generally don't need to break up the messages violating 80-column
>>> limit, and checkpatch.pl should be aware of this...
>
>
>> Oh. That's right.
>> It can be aware of that.
>
>
>    It is aware --- I'm just not sure it recognizes TP_printk() -- like it
> does recognize printk() fo that purpose.
>

It recognizes TP_printk as well. I have verified.

>> I just want to make the code easy to read and limit the textwidth to
>> 80 character.
>
>
>    Contrariwise, that's what you shouldn't do. Would simplify searching for
> the messages in the kernel source.
>

Agree to that.

>> If the message takes two lines as bellow,
>>      printk("xxx "
>>                       ^ space character.
>>                "yyy");
>> The checkpatch.pl  could also be aware of that if the first line is
>> not end with space character, but it couldn't be aware of that if run
>> with "checkpatch.pl -f xxxx.patch".
>
>
>    Option -f tells checkpatch.pl that it should check a source file, not a
> patch. I don't know why you use that with the patches...
>

Because the default option "--patch" sometimes shows some unnecessary warnings.
next time I will not use '-f' option.


>
>>>> Fixes: 563e0bb0dc74("net: tracepoint: replace tcp_set_state tracepoint
>>>> with
>>>> inet_sock_set_state tracepoint")
>>>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
>
>
> [...]
>
> MBR, Sergei
diff mbox series

Patch

diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
index 3b9094a..598399da 100644
--- a/include/trace/events/sock.h
+++ b/include/trace/events/sock.h
@@ -160,7 +160,7 @@ 
 		}
 	),

-	TP_printk("protocol=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4"
+	TP_printk("protocol=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 "
 			"saddrv6=%pI6c daddrv6=%pI6c oldstate=%s newstate=%s",
 			show_inet_protocol_name(__entry->protocol),
 			__entry->sport, __entry->dport,