2016-12-16 18:22:28

by Ozgur Karatas

[permalink] [raw]
Subject: [PATCH 1/1] tools: net: bpf_dbg.c fixed keyboard typo


This patch fixed to keyboard typo, brackets not closed.
I think, it should be close to parenthes.

Signed-off-by: Ozgur Karatas <[email protected]>
---
tools/net/bpf_dbg.c | 2 +-
1 files changed, 1 insertion(+), 1 deletions(-)

diff --git a/tools/net/bpf_dbg.c b/tools/net/bpf_dbg.c
index 4f254bc..f715f46 100644
--- a/tools/net/bpf_dbg.c
+++ b/tools/net/bpf_dbg.c
@@ -1213,7 +1213,7 @@ static int cmd_disassemble(char *line_string)

if (!bpf_prog_loaded())
return CMD_ERR;
- if (strlen(line_string) > 0 &&
+ if (strlen(line_string) > 0 &&)
(line = strtoul(line_string, NULL, 10)) < bpf_prog_len)
single_line = true;
if (single_line)
--
2.1.4


2016-12-16 18:35:33

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 1/1] tools: net: bpf_dbg.c fixed keyboard typo

On Fri, 2016-12-16 at 20:21 +0200, Ozgur Karatas wrote:
> This patch fixed to keyboard typo, brackets not closed.
> I think, it should be close to parenthes.

No.

Please compile and test your patches on your own system
before you send them.

2016-12-16 18:53:52

by Ozgur Karatas

[permalink] [raw]
Subject: Re: [PATCH 1/1] tools: net: bpf_dbg.c fixed keyboard typo

16.12.2016, 20:35, "Joe Perches" <[email protected]>:
> On Fri, 2016-12-16 at 20:21 +0200, Ozgur Karatas wrote:
>>  This patch fixed to keyboard typo, brackets not closed.
>>  I think, it should be close to parenthes.
>
> No.
>
> Please compile and test your patches on your own system
> before you send them.

Dear Perches,

I have already tested and it was not a part of the code anyway. if there is no parentheses, the code works incorrectly and give a error.
I'm sorry, have a little problem with my english but "line_string" variables would not equal NULL, 10. So the code it skips it and runs to "bpf_prog_len".
If it should be equal "0 &&" and already be completed (>) right?

if (strlen(line_string) > 0 &&
(line = strtoul(line_string, NULL, 10)) < bpf_prog_len)

Testing:

$ make M=tools/
tools//Makefile:6: scripts/Makefile.include: No such file or directory
$ cp tools/scripts/Makefile.include scripts/Makefile
$ make M=tools/
Building modules, stage 2.
MODPOST 0 modules

I try to module (insmod) and worked.

Regards,

~Ozgur

2016-12-16 18:58:54

by Ozgur Karatas

[permalink] [raw]
Subject: Re: [PATCH 1/1] tools: net: bpf_dbg.c fixed keyboard typo

16.12.2016, 20:35, "Joe Perches" <[email protected]>:
> On Fri, 2016-12-16 at 20:21 +0200, Ozgur Karatas wrote:
>>  This patch fixed to keyboard typo, brackets not closed.
>>  I think, it should be close to parenthes.
>
> No.
>
> Please compile and test your patches on your own system
> before you send them.

Also, checkpatch script give a error, it should not forget.

$ ./scripts/checkpatch.pl --file --terse tools/net/bpf_dbg.c
tools/net/bpf_dbg.c:1216: ERROR: do not use assignment in if condition

After fix:

$ ./scripts/checkpatch.pl --file --terse tools/net/bpf_dbg.c
total: 0 errors, 6 warnings, 1395 lines checked

Regards,

~Ozgur

2016-12-16 19:08:30

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH 1/1] tools: net: bpf_dbg.c fixed keyboard typo

Hello.

On 12/16/2016 09:21 PM, Ozgur Karatas wrote:

> This patch fixed to keyboard typo, brackets not closed.
> I think, it should be close to parenthes.
>
> Signed-off-by: Ozgur Karatas <[email protected]>
> ---
> tools/net/bpf_dbg.c | 2 +-
> 1 files changed, 1 insertion(+), 1 deletions(-)
>
> diff --git a/tools/net/bpf_dbg.c b/tools/net/bpf_dbg.c
> index 4f254bc..f715f46 100644
> --- a/tools/net/bpf_dbg.c
> +++ b/tools/net/bpf_dbg.c
> @@ -1213,7 +1213,7 @@ static int cmd_disassemble(char *line_string)
>
> if (!bpf_prog_loaded())
> return CMD_ERR;
> - if (strlen(line_string) > 0 &&
> + if (strlen(line_string) > 0 &&)

Have tried to you compile that? :-/

> (line = strtoul(line_string, NULL, 10)) < bpf_prog_len)

I think the code was correct before your patch...

> single_line = true;
> if (single_line)

MBR, Sergei

2016-12-16 19:18:19

by Ozgur Karatas

[permalink] [raw]
Subject: Re: [PATCH 1/1] tools: net: bpf_dbg.c fixed keyboard typo



16.12.2016, 21:08, "Sergei Shtylyov" <[email protected]>:
> Hello.

Hi

> On 12/16/2016 09:21 PM, Ozgur Karatas wrote:
>
>>  This patch fixed to keyboard typo, brackets not closed.
>>  I think, it should be close to parenthes.
>>
>>  Signed-off-by: Ozgur Karatas <[email protected]>
>>  ---
>>   tools/net/bpf_dbg.c | 2 +-
>>   1 files changed, 1 insertion(+), 1 deletions(-)
>>
>>  diff --git a/tools/net/bpf_dbg.c b/tools/net/bpf_dbg.c
>>  index 4f254bc..f715f46 100644
>>  --- a/tools/net/bpf_dbg.c
>>  +++ b/tools/net/bpf_dbg.c
>>  @@ -1213,7 +1213,7 @@ static int cmd_disassemble(char *line_string)
>>
>>           if (!bpf_prog_loaded())
>>                   return CMD_ERR;
>>  - if (strlen(line_string) > 0 &&
>>  + if (strlen(line_string) > 0 &&)
>
>     Have tried to you compile that? :-/

Yes, i compiled but I apologize if there was NAK.
Also, checkpatch give a error.

I could be wrong, will review again.

Best Regards!

>>               (line = strtoul(line_string, NULL, 10)) < bpf_prog_len)
>
>     I think the code was correct before your patch...
>
>>                   single_line = true;
>>           if (single_line)
>
> MBR, Sergei

~Ozgur

2016-12-16 19:32:11

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH 1/1] tools: net: bpf_dbg.c fixed keyboard typo

On 12/16/2016 07:21 PM, Ozgur Karatas wrote:
>
> This patch fixed to keyboard typo, brackets not closed.
> I think, it should be close to parenthes.
>
> Signed-off-by: Ozgur Karatas <[email protected]>

NAK for obvious reasons ...

> ---
> tools/net/bpf_dbg.c | 2 +-
> 1 files changed, 1 insertion(+), 1 deletions(-)
>
> diff --git a/tools/net/bpf_dbg.c b/tools/net/bpf_dbg.c
> index 4f254bc..f715f46 100644
> --- a/tools/net/bpf_dbg.c
> +++ b/tools/net/bpf_dbg.c
> @@ -1213,7 +1213,7 @@ static int cmd_disassemble(char *line_string)
>
> if (!bpf_prog_loaded())
> return CMD_ERR;
> - if (strlen(line_string) > 0 &&
> + if (strlen(line_string) > 0 &&)
> (line = strtoul(line_string, NULL, 10)) < bpf_prog_len)
> single_line = true;
> if (single_line)
>