Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1535380 > unrolled thread
| Started by | Pan Bian <bianpan2016@163.com> |
|---|---|
| First post | 2016-12-03 12:40 +0100 |
| Last post | 2016-12-03 22:10 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH 1/1] net: caif: fix ineffective error check Pan Bian <bianpan2016@163.com> - 2016-12-03 12:40 +0100
Re: [PATCH 1/1] net: caif: fix ineffective error check Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-12-03 14:20 +0100
Re: [PATCH 1/1] net: caif: fix ineffective error check Pan Bian <bianpan201602@163.com> - 2016-12-03 17:30 +0100
Re: [PATCH 1/1] net: caif: fix ineffective error check Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-12-03 22:10 +0100
| From | Pan Bian <bianpan2016@163.com> |
|---|---|
| Date | 2016-12-03 12:40 +0100 |
| Subject | [PATCH 1/1] net: caif: fix ineffective error check |
| Message-ID | <sKgPD-wb-1@gated-at.bofh.it> |
In function caif_sktinit_module(), the check of the return value of
sock_register() seems ineffective. This patch fixes it.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188751
Signed-off-by: Pan Bian <bianpan2016@163.com>
---
net/caif/caif_socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index aa209b1..2a689a3 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -1108,7 +1108,7 @@ static int caif_create(struct net *net, struct socket *sock, int protocol,
static int __init caif_sktinit_module(void)
{
int err = sock_register(&caif_family_ops);
- if (!err)
+ if (err)
return err;
return 0;
}
--
1.9.1
[toc] | [next] | [standalone]
| From | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> |
|---|---|
| Date | 2016-12-03 14:20 +0100 |
| Message-ID | <sKioq-1Lm-7@gated-at.bofh.it> |
| In reply to | #1535380 |
Hello.
On 12/3/2016 2:18 PM, Pan Bian wrote:
> In function caif_sktinit_module(), the check of the return value of
> sock_register() seems ineffective. This patch fixes it.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188751
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
> net/caif/caif_socket.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
> index aa209b1..2a689a3 100644
> --- a/net/caif/caif_socket.c
> +++ b/net/caif/caif_socket.c
> @@ -1108,7 +1108,7 @@ static int caif_create(struct net *net, struct socket *sock, int protocol,
> static int __init caif_sktinit_module(void)
> {
> int err = sock_register(&caif_family_ops);
> - if (!err)
> + if (err)
> return err;
Why not just:
return sock_register(&caif_family_ops);
> return 0;
> }
MBR, Sergei
[toc] | [prev] | [next] | [standalone]
| From | Pan Bian <bianpan201602@163.com> |
|---|---|
| Date | 2016-12-03 17:30 +0100 |
| Message-ID | <sKlmi-3FM-13@gated-at.bofh.it> |
| In reply to | #1535397 |
From: PanBian <bianpan2016@163.com>
Hello Sergei,
On Sat, Dec 03, 2016 at 04:17:51PM +0300, Sergei Shtylyov wrote:
> Hello.
>
> On 12/3/2016 2:18 PM, Pan Bian wrote:
>
> >In function caif_sktinit_module(), the check of the return value of
> >sock_register() seems ineffective. This patch fixes it.
> >
> >Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188751
> >
> >Signed-off-by: Pan Bian <bianpan2016@163.com>
> >---
> > net/caif/caif_socket.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
> >index aa209b1..2a689a3 100644
> >--- a/net/caif/caif_socket.c
> >+++ b/net/caif/caif_socket.c
> >@@ -1108,7 +1108,7 @@ static int caif_create(struct net *net, struct socket *sock, int protocol,
> > static int __init caif_sktinit_module(void)
> > {
> > int err = sock_register(&caif_family_ops);
> >- if (!err)
> >+ if (err)
> > return err;
>
> Why not just:
>
> return sock_register(&caif_family_ops);
>
Your solution looks much cleaner.
But I am not really sure whether it is the author's intention to
return 0 anyway. Do you have any idea?
Thanks!
> > return 0;
> > }
>
> MBR, Sergei
>
Best regards,
Pan
[toc] | [prev] | [next] | [standalone]
| From | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> |
|---|---|
| Date | 2016-12-03 22:10 +0100 |
| Message-ID | <sKpJf-6rj-9@gated-at.bofh.it> |
| In reply to | #1535453 |
On 12/03/2016 06:38 PM, Pan Bian wrote:
>>> In function caif_sktinit_module(), the check of the return value of
>>> sock_register() seems ineffective. This patch fixes it.
>>>
>>> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188751
>>>
>>> Signed-off-by: Pan Bian <bianpan2016@163.com>
>>> ---
>>> net/caif/caif_socket.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
>>> index aa209b1..2a689a3 100644
>>> --- a/net/caif/caif_socket.c
>>> +++ b/net/caif/caif_socket.c
>>> @@ -1108,7 +1108,7 @@ static int caif_create(struct net *net, struct socket *sock, int protocol,
>>> static int __init caif_sktinit_module(void)
>>> {
>>> int err = sock_register(&caif_family_ops);
>>> - if (!err)
>>> + if (err)
>>> return err;
>>
>> Why not just:
>>
>> return sock_register(&caif_family_ops);
>>
> Your solution looks much cleaner.
>
> But I am not really sure whether it is the author's intention to
> return 0 anyway. Do you have any idea?
I don't think so, the error check seems to have a typo.
[...]
> Best regards,
> Pan
MBR, Sergei
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web