Re: Fw: [Kernel-janitors] net/atm/clip.c: check kmem_cache_create() #1
From: chas williams (contractor) <hidden>
Date: 2004-02-05 12:22:40
In message [ref],Francois Romieu w rites:
One should probably apply the following patch on top of it btw. Unbalanced call to create_proc_entry() on error path.
how about the following instead? we probably shouldnt register the proc entry until clip_tbl is going to be ready for use anyway (the arp table iterators should probably also use clip_tbl instead of clip_tbl_hook). ===== net/atm/clip.c 1.30 vs edited =====
--- 1.30/net/atm/clip.c Wed Feb 4 13:07:57 2004
+++ edited/net/atm/clip.c Thu Feb 5 07:18:03 2004@@ -1008,14 +1008,6 @@ static int __init atm_clip_init(void) { -#ifdef CONFIG_PROC_FS - struct proc_dir_entry *p; - - p = create_proc_entry("arp", S_IRUGO, atm_proc_root); - if (p) - p->proc_fops = &arp_seq_fops; -#endif - /* we should use neigh_table_init() */ clip_tbl.lock = RW_LOCK_UNLOCKED; clip_tbl.kmem_cachep = kmem_cache_create(clip_tbl.id,
@@ -1032,6 +1024,16 @@ clip_tbl_hook = &clip_tbl; register_atm_ioctl(&clip_ioctl_ops); + +#ifdef CONFIG_PROC_FS +{ + struct proc_dir_entry *p; + + p = create_proc_entry("arp", S_IRUGO, atm_proc_root); + if (p) + p->proc_fops = &arp_seq_fops; +} +#endif return 0; }