[prev in list] [next in list] [prev in thread] [next in thread]
List: kernel-janitors
Subject: Re: [KJ] linux-2.6.7/net/core: add error checks
From: walter harms <wharms () bfs ! de>
Date: 2004-11-24 18:44:03
Message-ID: 41A4D673.1070808 () bfs ! de
[Download RAW message or body]
hi max,
i guess you refer to netlink_kernel_create() ? there is no
netlink_kernel_remove(). (i looked into netlink/af_netlink.c).
I am not used to this functions and have simply no time to do.
Is it realy needed ? The original code called panic() if something
failed.
perhaps acme or someone else can provide a netlink_kernel_remove() ?
re,
walter
ps: Daniele Pizzoni was also looking into net/core/* behaps he can help ?
maximilian attems wrote:
> On Sun, 24 Oct 2004, Walter Harms wrote:
>
>
>>this adds some error checks.
>>note that some returncodes have changed for void to int
>>to find the error.
>>
>>
>>
>>Signed-off-by: walter harms <wharms@bfs.de>
>>--- linux-2.6.7/net/core/dst.c.bak 2004-07-31 13:16:49.000000000 +0200
>>+++ linux-2.6.7/net/core/dst.c 2004-07-31 13:19:43.000000000 +0200
>>@@ -256,9 +256,9 @@
>> .notifier_call = dst_dev_event,
>> };
>>
>>-void __init dst_init(void)
>>+int __init dst_init(void)
>> {
>>- register_netdevice_notifier(&dst_dev_notifier);
>>+ return register_netdevice_notifier(&dst_dev_notifier);
>> }
>>
>> EXPORT_SYMBOL(__dst_free);
>>--- linux-2.6.7/net/core/rtnetlink.c.bak 2004-07-31 13:21:49.000000000 +0200
>>+++ linux-2.6.7/net/core/rtnetlink.c 2004-08-01 11:34:51.000000000 +0200
>>@@ -557,15 +557,24 @@
>> .notifier_call = rtnetlink_event,
>> };
>>
>>-void __init rtnetlink_init(void)
>>+int __init rtnetlink_init(void)
>> {
>> rtnl = netlink_kernel_create(NETLINK_ROUTE, rtnetlink_rcv);
>>- if (rtnl == NULL)
>>- panic("rtnetlink_init: cannot initialize rtnetlink\n");
>>+ if (rtnl == NULL) {
>>+ printk(KERN_ERR "rtnetlink_init: cannot initialize rtnetlink\n");
>>+ return -1;
>>+ }
>>+
>> netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV);
>>- register_netdevice_notifier(&rtnetlink_dev_notifier);
>>+
>>+ if ( register_netdevice_notifier(&rtnetlink_dev_notifier)<0) {
>>+
>>+ printk(KERN_ERR "rtnetlink_init: cannot initialize rtnetlink notifier\n");
>>+ return -1;
>>+ }
>
> intruduces a leak here with aboves, no?
>
>> rtnetlink_links[PF_UNSPEC] = link_rtnetlink_table;
>> rtnetlink_links[PF_PACKET] = link_rtnetlink_table;
>>+ return 0;
>> }
>>
>> EXPORT_SYMBOL(__rta_fill);
>>--- linux-2.6.7/include/linux/rtnetlink.h.bak 2004-07-31 13:47:44.000000000 +0200
>>+++ linux-2.6.7/include/linux/rtnetlink.h 2004-07-31 13:48:07.000000000 +0200
>>@@ -742,7 +742,7 @@
>>
>> extern void rtnl_lock(void);
>> extern void rtnl_unlock(void);
>>-extern void rtnetlink_init(void);
>>+extern int rtnetlink_init(void);
>>
>> #define ASSERT_RTNL() do { \
>> if (unlikely(down_trylock(&rtnl_sem) == 0)) { \
>>--- linux-2.6.7/include/net/dst.h.bak 2004-06-16 07:20:03.000000000 +0200
>>+++ linux-2.6.7/include/net/dst.h 2004-07-31 13:20:31.000000000 +0200
>>@@ -245,7 +245,7 @@
>> }
>> }
>>
>>-extern void dst_init(void);
>>+extern int dst_init(void);
>>
>> struct flowi;
>> #ifndef CONFIG_XFRM
>
>
> please rework on current some parts of error checking got
> introduced inbetween, so this doesn't apply anymore.
>
>
> --
> maks
>
>
>
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic