* [PATCH] netlink oops fix due to incorrect error code
@ 2006-01-09 14:42 Kirill Korotaev
2006-01-09 21:09 ` [PATCH] Fix more "if ((err = foo() < 0))" typos Alexey Dobriyan
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Kirill Korotaev @ 2006-01-09 14:42 UTC (permalink / raw)
To: Linus Torvalds, Andrew Morton, linux-kernel, Dmitry Mishin,
Stanislav Protassov
[-- Attachment #1: Type: text/plain, Size: 292 bytes --]
Fixed oops after failed netlink socket creation.
Wrong parathenses in if() statement caused err to be 1,
instead of negative value.
Trivial fix, not trivial to find though.
Signed-Off-By: Dmitry Mishin <dim@sw.ru>
Signed-Off-By: Kirill Korotaev <dev@openvz.org>
Kirill
P.S. against 2.6.15
[-- Attachment #2: diff-ms-netlink-create-fix-20060109 --]
[-- Type: text/plain, Size: 420 bytes --]
--- ./net/netlink/af_netlink.c.nlfix 2006-01-06 18:37:28.000000000 +0300
+++ ./net/netlink/af_netlink.c 2006-01-09 16:40:49.000000000 +0300
@@ -416,7 +416,7 @@ static int netlink_create(struct socket
groups = nl_table[protocol].groups;
netlink_unlock_table();
- if ((err = __netlink_create(sock, protocol) < 0))
+ if ((err = __netlink_create(sock, protocol)) < 0)
goto out_module;
nlk = nlk_sk(sock->sk);
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] Fix more "if ((err = foo() < 0))" typos
2006-01-09 14:42 [PATCH] netlink oops fix due to incorrect error code Kirill Korotaev
@ 2006-01-09 21:09 ` Alexey Dobriyan
2006-01-09 23:50 ` [PATCH] netlink oops fix due to incorrect error code Patrick McHardy
2006-01-10 8:38 ` [stable] " Chris Wright
2 siblings, 0 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2006-01-09 21:09 UTC (permalink / raw)
To: Kirill Korotaev
Cc: Linus Torvalds, Andrew Morton, linux-kernel, Dmitry Mishin,
Stanislav Protassov
Another reason to use:
ret = foo();
if (ret < 0)
goto out;
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
Documentation/kprobes.txt | 3 ++-
arch/mips/kernel/vpe.c | 3 ++-
drivers/media/dvb/frontends/mt312.c | 3 ++-
3 files changed, 6 insertions(+), 3 deletions(-)
diff -uprN linux-vanilla/Documentation/kprobes.txt linux-1/Documentation/kprobes.txt
--- linux-vanilla/Documentation/kprobes.txt 2006-01-09 16:02:19.000000000 +0300
+++ linux-1/Documentation/kprobes.txt 2006-01-09 23:59:12.000000000 +0300
@@ -411,7 +411,8 @@ int init_module(void)
printk("Couldn't find %s to plant kprobe\n", "do_fork");
return -1;
}
- if ((ret = register_kprobe(&kp) < 0)) {
+ ret = register_kprobe(&kp);
+ if (ret < 0) {
printk("register_kprobe failed, returned %d\n", ret);
return -1;
}
diff -uprN linux-vanilla/arch/mips/kernel/vpe.c linux-1/arch/mips/kernel/vpe.c
--- linux-vanilla/arch/mips/kernel/vpe.c 2006-01-09 16:02:20.000000000 +0300
+++ linux-1/arch/mips/kernel/vpe.c 2006-01-10 00:00:35.000000000 +0300
@@ -1171,7 +1171,8 @@ static int __init vpe_module_init(void)
return -ENODEV;
}
- if ((major = register_chrdev(0, module_name, &vpe_fops) < 0)) {
+ major = register_chrdev(0, module_name, &vpe_fops);
+ if (major < 0) {
printk("VPE loader: unable to register character device\n");
return major;
}
diff -uprN linux-vanilla/drivers/media/dvb/frontends/mt312.c linux-1/drivers/media/dvb/frontends/mt312.c
--- linux-vanilla/drivers/media/dvb/frontends/mt312.c 2006-01-09 16:02:22.000000000 +0300
+++ linux-1/drivers/media/dvb/frontends/mt312.c 2006-01-09 23:59:46.000000000 +0300
@@ -501,7 +501,8 @@ static int mt312_set_frontend(struct dvb
case ID_VP310:
// For now we will do this only for the VP310.
// It should be better for the mt312 as well, but tunning will be slower. ACCJr 09/29/03
- if ((ret = mt312_readreg(state, CONFIG, &config_val) < 0))
+ ret = mt312_readreg(state, CONFIG, &config_val);
+ if (ret < 0)
return ret;
if (p->u.qpsk.symbol_rate >= 30000000) //Note that 30MS/s should use 90MHz
{
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] netlink oops fix due to incorrect error code
2006-01-09 14:42 [PATCH] netlink oops fix due to incorrect error code Kirill Korotaev
2006-01-09 21:09 ` [PATCH] Fix more "if ((err = foo() < 0))" typos Alexey Dobriyan
@ 2006-01-09 23:50 ` Patrick McHardy
2006-01-09 23:54 ` David S. Miller
2006-01-10 8:38 ` [stable] " Chris Wright
2 siblings, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2006-01-09 23:50 UTC (permalink / raw)
To: Kirill Korotaev, David S. Miller
Cc: Linus Torvalds, Andrew Morton, linux-kernel, Dmitry Mishin,
Stanislav Protassov, Kernel Netdev Mailing List
Kirill Korotaev wrote:
> Fixed oops after failed netlink socket creation.
> Wrong parathenses in if() statement caused err to be 1,
> instead of negative value.
> Trivial fix, not trivial to find though.
>
> Signed-Off-By: Dmitry Mishin <dim@sw.ru>
> Signed-Off-By: Kirill Korotaev <dev@openvz.org>
Good catch. Dave, please apply.
>
> ------------------------------------------------------------------------
>
> --- ./net/netlink/af_netlink.c.nlfix 2006-01-06 18:37:28.000000000 +0300
> +++ ./net/netlink/af_netlink.c 2006-01-09 16:40:49.000000000 +0300
> @@ -416,7 +416,7 @@ static int netlink_create(struct socket
> groups = nl_table[protocol].groups;
> netlink_unlock_table();
>
> - if ((err = __netlink_create(sock, protocol) < 0))
> + if ((err = __netlink_create(sock, protocol)) < 0)
> goto out_module;
>
> nlk = nlk_sk(sock->sk);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] netlink oops fix due to incorrect error code
2006-01-09 23:50 ` [PATCH] netlink oops fix due to incorrect error code Patrick McHardy
@ 2006-01-09 23:54 ` David S. Miller
0 siblings, 0 replies; 5+ messages in thread
From: David S. Miller @ 2006-01-09 23:54 UTC (permalink / raw)
To: kaber; +Cc: dev, torvalds, akpm, linux-kernel, dim, st, netdev
From: Patrick McHardy <kaber@trash.net>
Date: Tue, 10 Jan 2006 00:50:52 +0100
> Kirill Korotaev wrote:
> > Fixed oops after failed netlink socket creation.
> > Wrong parathenses in if() statement caused err to be 1,
> > instead of negative value.
> > Trivial fix, not trivial to find though.
> >
> > Signed-Off-By: Dmitry Mishin <dim@sw.ru>
> > Signed-Off-By: Kirill Korotaev <dev@openvz.org>
>
> Good catch. Dave, please apply.
Already in Linus's tree, he applied it directly :-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [stable] [PATCH] netlink oops fix due to incorrect error code
2006-01-09 14:42 [PATCH] netlink oops fix due to incorrect error code Kirill Korotaev
2006-01-09 21:09 ` [PATCH] Fix more "if ((err = foo() < 0))" typos Alexey Dobriyan
2006-01-09 23:50 ` [PATCH] netlink oops fix due to incorrect error code Patrick McHardy
@ 2006-01-10 8:38 ` Chris Wright
2 siblings, 0 replies; 5+ messages in thread
From: Chris Wright @ 2006-01-10 8:38 UTC (permalink / raw)
To: Kirill Korotaev
Cc: Linus Torvalds, Andrew Morton, linux-kernel, Dmitry Mishin,
Stanislav Protassov
* Kirill Korotaev (dev@openvz.org) wrote:
> Fixed oops after failed netlink socket creation.
> Wrong parathenses in if() statement caused err to be 1,
> instead of negative value.
> Trivial fix, not trivial to find though.
Thanks, queued to -stable.
-chris
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-01-10 8:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-09 14:42 [PATCH] netlink oops fix due to incorrect error code Kirill Korotaev
2006-01-09 21:09 ` [PATCH] Fix more "if ((err = foo() < 0))" typos Alexey Dobriyan
2006-01-09 23:50 ` [PATCH] netlink oops fix due to incorrect error code Patrick McHardy
2006-01-09 23:54 ` David S. Miller
2006-01-10 8:38 ` [stable] " Chris Wright
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).