* [PATCH 1/1] net: caif: fix ineffective error check
@ 2016-12-03 11:18 Pan Bian
2016-12-03 13:17 ` Sergei Shtylyov
0 siblings, 1 reply; 4+ messages in thread
From: Pan Bian @ 2016-12-03 11:18 UTC (permalink / raw)
To: Dmitry Tarnyagin, David S. Miller, netdev; +Cc: linux-kernel, Pan Bian
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] net: caif: fix ineffective error check
2016-12-03 11:18 [PATCH 1/1] net: caif: fix ineffective error check Pan Bian
@ 2016-12-03 13:17 ` Sergei Shtylyov
2016-12-03 15:38 ` Pan Bian
0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2016-12-03 13:17 UTC (permalink / raw)
To: Pan Bian, Dmitry Tarnyagin, David S. Miller, netdev; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] net: caif: fix ineffective error check
2016-12-03 13:17 ` Sergei Shtylyov
@ 2016-12-03 15:38 ` Pan Bian
2016-12-03 21:05 ` Sergei Shtylyov
0 siblings, 1 reply; 4+ messages in thread
From: Pan Bian @ 2016-12-03 15:38 UTC (permalink / raw)
To: Sergei Shtylyov, Dmitry Tarnyagin, David S. Miller
Cc: PanBian, netdev, linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] net: caif: fix ineffective error check
2016-12-03 15:38 ` Pan Bian
@ 2016-12-03 21:05 ` Sergei Shtylyov
0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2016-12-03 21:05 UTC (permalink / raw)
To: PanBian, Dmitry Tarnyagin, David S. Miller; +Cc: netdev, linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-12-03 21:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-03 11:18 [PATCH 1/1] net: caif: fix ineffective error check Pan Bian
2016-12-03 13:17 ` Sergei Shtylyov
2016-12-03 15:38 ` Pan Bian
2016-12-03 21:05 ` Sergei Shtylyov
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).