create_proc_entry error handling: net
Subsystems (11)
PATCH 5/6 create_proc_entry error handling: net
Added appropriate KERN_ERR/KERN_WARNING messages whenever create_proc_entry fails.
Tested using allmodconfig configuration and also by changing Makefiles/Kconfig to make sure all files are compiled
Signed-off-by Amol Lad <[email protected]>
--- 8021q/vlanproc.c | 7 +++++-- appletalk/atalk_proc.c | 16 ++++++++++++---- atm/br2684.c | 4 +++- atm/clip.c | 2 ++ atm/lec.c | 2 ++ atm/proc.c | 8 ++++++-- ieee80211/ieee80211_module.c | 1 + ipv4/netfilter/ip_conntrack_standalone.c | 4 +++- ipv4/netfilter/ipt_CLUSTERIP.c | 1 + ipv4/netfilter/ipt_hashlimit.c | 1 + ipv4/netfilter/ipt_recent.c | 1 + ipv4/route.c | 2 ++ ipv6/proc.c | 4 +++- ipx/ipx_proc.c | 12 +++++++++--- irda/ircomm/ircomm_core.c | 5 +++-- irda/irproc.c | 2 ++ llc/llc_proc.c | 8 ++++++-- netfilter/nf_conntrack_standalone.c | 4 +++- netfilter/nf_log.c | 4 +++- netfilter/nf_queue.c | 4 +++- netfilter/nfnetlink_log.c | 4 +++- netfilter/nfnetlink_queue.c | 4 +++- rxrpc/proc.c | 16 ++++++++++++---- sctp/proc.c | 12 +++++++++--- sunrpc/cache.c | 9 ++++++--- sunrpc/stats.c | 4 +++- wanrouter/wanproc.c | 12 +++++++++--- x25/x25_proc.c | 8 ++++++-- 28 files changed, 122 insertions(+), 39 deletions(-)
---
net/8021q/vlanproc.c +5 -2
@@ -164,7 +164,8 @@ int __init vlan_proc_init(void)if (proc_vlan_conf) { proc_vlan_conf->proc_fops = &vlan_fops;return 0 ; - } + }else +printk (KERN_WARNING "Unable to create '%s' proc entry.\n" , name_conf); }vlan_proc_cleanup ();return -ENOBUFS ;
@@ -188,8 +189,10 @@ int vlan_proc_add_dev (struct net_device dev_info->dent =create_proc_entry (vlandev->name,S_IFREG |S_IRUSR |S_IWUSR , proc_vlan_dir); -if (!dev_info->dent) +if (!dev_info->dent) { +printk (KERN_ERR "Unable to create '%s' proc entry.\n" , vlandev->name);return -ENOBUFS ; + } dev_info->dent->proc_fops = &vlandev_fops; dev_info->dent->data = vlandev;
net/appletalk/atalk_proc.c +12 -4
@@ -277,23 +277,31 @@ int __init atalk_proc_init(void) atalk_proc_dir->owner =THIS_MODULE ; p =create_proc_entry ("interface" ,S_IRUGO , atalk_proc_dir); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'interface' proc entry.\n" ); goto out_interface; + } p->proc_fops = &atalk_seq_interface_fops; p =create_proc_entry ("route" ,S_IRUGO , atalk_proc_dir); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'route' proc entry.\n" ); goto out_route; + } p->proc_fops = &atalk_seq_route_fops; p =create_proc_entry ("socket" ,S_IRUGO , atalk_proc_dir); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'socket' proc entry.\n" ); goto out_socket; + } p->proc_fops = &atalk_seq_socket_fops; p =create_proc_entry ("arp" ,S_IRUGO , atalk_proc_dir); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'arp' proc entry.\n" ); goto out_arp; + } p->proc_fops = &atalk_seq_arp_fops; rc =0 ;
net/atm/br2684.c +3 -1
@@ -781,8 +781,10 @@ static int __init br2684_init(void) {#ifdef CONFIG_PROC_FS struct proc_dir_entry *p; -if ((p =create_proc_entry ("br2684" ,0 , atm_proc_root)) =NULL ) +if ((p =create_proc_entry ("br2684" ,0 , atm_proc_root)) =NULL ) { +printk (KERN_ERR "Unable to create 'br2684' proc entry.\n" );return -ENOMEM ; + } p->proc_fops = &br2684_proc_ops;#endif register_atm_ioctl (&br2684_ioctl_ops);
net/atm/clip.c +2 -0
@@ -977,6 +977,8 @@ static int __init atm_clip_init(void) p =create_proc_entry ("arp" ,S_IRUGO , atm_proc_root);if (p) p->proc_fops = &arp_seq_fops; +else + printk(KERN_WARNING "Unable to create 'arp' proc entry.\n"); }#endif
net/atm/lec.c +2 -0
@@ -1228,6 +1228,8 @@ static int __init lane_module_init(void) p =create_proc_entry ("lec" ,S_IRUGO , atm_proc_root);if (p) p->proc_fops = &lec_seq_fops; +else +printk (KERN_WARNING "Unable to create 'lec' proc entry.\n" );#endif register_atm_ioctl (&lane_ioctl_ops);
net/atm/proc.c +6 -2
@@ -433,8 +433,10 @@ int atm_proc_dev_register(struct atm_devsprintf (dev->proc_name,"%s:%d" ,dev->type, dev->number); dev->proc_entry =create_proc_entry (dev->proc_name,0 , atm_proc_root); -if (!dev->proc_entry) +if (!dev->proc_entry) { +printk (KERN_ERR "Unable to create '%s' proc entry.\n" , dev->proc_name); goto err_free_name; + } dev->proc_entry->data = dev; dev->proc_entry->proc_fops = &proc_atm_dev_ops; dev->proc_entry->owner =THIS_MODULE ;
@@ -490,8 +492,10 @@ int __init atm_proc_init(void)struct proc_dir_entry *dirent; dirent =create_proc_entry (e->name,S_IRUGO , atm_proc_root); -if (!dirent) +if (!dirent) { +printk (KERN_ERR "Unable to create '%s' proc entry.\n" , e->name); goto err_out_remove; + } dirent->proc_fops = e->proc_fops; dirent->owner =THIS_MODULE ; e->dirent = dirent;
net/ieee80211/ieee80211_module.c +1 -0
@@ -255,6 +255,7 @@ static int __init ieee80211_init(void) e =create_proc_entry ("debug_level" ,S_IFREG |S_IRUGO |S_IWUSR , ieee80211_proc);if (!e) { +printk (KERN_ERR "Unable to create 'debug_level' proc entry.\n" );remove_proc_entry (DRV_NAME , proc_net); ieee80211_proc =NULL ;return -EIO ;
net/ipv4/netfilter/ip_conntrack_standalone.c +3 -1
@@ -841,8 +841,10 @@ static int __init ip_conntrack_standalonif (!proc_exp) goto cleanup_proc; proc_stat =create_proc_entry ("ip_conntrack" ,S_IRUGO , proc_net_stat); -if (!proc_stat) +if (!proc_stat) { +printk (KERN_ERR "Unable to create 'ip_conntrack' proc entry.\n" ); goto cleanup_proc_exp; + } proc_stat->proc_fops = &ct_cpu_seq_fops; proc_stat->owner =THIS_MODULE ;
net/ipv4/netfilter/ipt_CLUSTERIP.c +1 -0
@@ -191,6 +191,7 @@ clusterip_config_init(struct ipt_clustersprintf (buffer,"%u.%u.%u.%u" ,NIPQUAD (ip)); c->pde =create_proc_entry (buffer,S_IWUSR |S_IRUSR , clusterip_procdir);if (!c->pde) { +printk (KERN_ERR "Unable to create '%s' proc entry.\n" , buffer);kfree (c);return NULL ; }
net/ipv4/netfilter/ipt_hashlimit.c +1 -0
@@ -221,6 +221,7 @@ static int htable_create(struct ipt_hashspin_lock_init (&hinfo->lock); hinfo->pde =create_proc_entry (minfo->name,0 , hashlimit_procdir);if (!hinfo->pde) { +printk (KERN_ERR "Unable to create '%s' proc entry.\n" , minfo->name);vfree (hinfo);return -1 ; }
net/ipv4/netfilter/ipt_recent.c +1 -0
@@ -270,6 +270,7 @@ ipt_recent_checkentry(const char *tablen#ifdef CONFIG_PROC_FS t->proc =create_proc_entry (t->name, ip_list_perms, proc_dir);if (t->proc =NULL ) { +printk (KERN_ERR "Unable to create '%s' proc entry.\n" , t->name);kfree (t); goto out; }
net/ipv4/route.c +2 -0
@@ -3194,6 +3194,8 @@ int __init ip_rt_init(void)if (!proc_net_fops_create ("rt_cache" ,S_IRUGO , &rt_cache_seq_fops) || !(rtstat_pde =create_proc_entry ("rt_cache" ,S_IRUGO , proc_net_stat))) { +if (!rtstat_pde) +printk (KERN_ERR "Unable to create 'rt_cache' proc entry.\n" );return -ENOMEM ; } rtstat_pde->proc_fops = &rt_cpu_seq_fops;
net/ipv6/proc.c +3 -1
@@ -207,8 +207,10 @@ int snmp6_register_dev(struct inet6_devreturn -ENOENT ; p =create_proc_entry (idev->dev->name,S_IRUGO , proc_net_devsnmp6); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create '%s' proc entry.\n" , idev->dev->name);return -ENOMEM ; + } p->data = idev; p->proc_fops = &snmp6_seq_fops;
net/ipx/ipx_proc.c +9 -3
@@ -358,18 +358,24 @@ int __init ipx_proc_init(void)if (!ipx_proc_dir) goto out; p =create_proc_entry ("interface" ,S_IRUGO , ipx_proc_dir); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'interface' proc entry.\n" ); goto out_interface; + } p->proc_fops = &ipx_seq_interface_fops; p =create_proc_entry ("route" ,S_IRUGO , ipx_proc_dir); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'route' proc entry.\n" ); goto out_route; + } p->proc_fops = &ipx_seq_route_fops; p =create_proc_entry ("socket" ,S_IRUGO , ipx_proc_dir); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'socket' proc entry.\n" ); goto out_socket; + } p->proc_fops = &ipx_seq_socket_fops;
net/irda/ircomm/ircomm_core.c +3 -2
@@ -76,11 +76,12 @@ static int __init ircomm_init(void) }#ifdef CONFIG_PROC_FS - {struct proc_dir_entry *ent; +struct proc_dir_entry *ent; ent =create_proc_entry ("ircomm" ,0 , proc_irda);if (ent) ent->proc_fops = &ircomm_proc_fops; - } +else +printk (KERN_WARNING "Unable to create 'ircomm' proc entry.\n" );#endif /* CONFIG_PROC_FS */ IRDA_MESSAGE ("IrCOMM protocol (Dag Brattli)\n" );
net/irda/irproc.c +2 -0
@@ -75,6 +75,8 @@ void __init irda_proc_register(void) d =create_proc_entry (irda_dirs[i].name,0 , proc_irda);if (d) d->proc_fops = irda_dirs[i].fops; +else +printk (KERN_WARNING "Unable to create '%s' proc entry.\n" , irda_dirs[i].name); } }
net/llc/llc_proc.c +6 -2
@@ -237,14 +237,18 @@ int __init llc_proc_init(void) llc_proc_dir->owner =THIS_MODULE ; p =create_proc_entry ("socket" ,S_IRUGO , llc_proc_dir); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'socket' proc entry.\n" ); goto out_socket; + } p->proc_fops = &llc_seq_socket_fops; p =create_proc_entry ("core" ,S_IRUGO , llc_proc_dir); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'core' proc entry.\n" ); goto out_core; + } p->proc_fops = &llc_seq_core_fops;
net/netfilter/nf_conntrack_standalone.c +3 -1
@@ -783,8 +783,10 @@ static int __init nf_conntrack_standalonif (!proc_exp) goto cleanup_proc; proc_stat =create_proc_entry ("nf_conntrack" ,S_IRUGO , proc_net_stat); -if (!proc_stat) +if (!proc_stat) { +printk (KERN_ERR "Unable to create 'nf_conntrack' proc entry.\n" ); goto cleanup_proc_exp; + } proc_stat->proc_fops = &ct_cpu_seq_fops; proc_stat->owner =THIS_MODULE ;
net/netfilter/nf_log.c +3 -1
@@ -168,8 +168,10 @@ int __init netfilter_log_init(void)struct proc_dir_entry *pde; pde =create_proc_entry ("nf_log" ,S_IRUGO , proc_net_netfilter); -if (!pde) +if (!pde) { +printk (KERN_ERR "Unable to create 'nf_log' proc entry.\n" );return -1 ; + } pde->proc_fops = &nflog_file_ops;#endif
net/netfilter/nfnetlink_log.c +3 -1
@@ -1061,8 +1061,10 @@ static int __init nfnetlink_log_init(voi#ifdef CONFIG_PROC_FS proc_nful =create_proc_entry ("nfnetlink_log" ,0440 , proc_net_netfilter); -if (!proc_nful) +if (!proc_nful) { +printk (KERN_ERR "Unable to create 'nfnetlink_log' proc entry.\n" ); goto cleanup_subsys; + } proc_nful->proc_fops = &nful_file_ops;#endif return status;
net/netfilter/nfnetlink_queue.c +3 -1
@@ -1099,8 +1099,10 @@ static int __init nfnetlink_queue_init(v#ifdef CONFIG_PROC_FS proc_nfqueue =create_proc_entry ("nfnetlink_queue" ,0440 , proc_net_netfilter); -if (!proc_nfqueue) +if (!proc_nfqueue) { +printk (KERN_ERR "Unable to create 'nfnetlink_queue' proc entry.\n" ); goto cleanup_subsys; + } proc_nfqueue->proc_fops = &nfqnl_file_ops;#endif
net/netfilter/nf_queue.c +3 -1
@@ -307,8 +307,10 @@ int __init netfilter_queue_init(void)struct proc_dir_entry *pde; pde =create_proc_entry ("nf_queue" ,S_IRUGO , proc_net_netfilter); -if (!pde) +if (!pde) { +printk (KERN_ERR "Unable to create 'nf_queue' proc entry.\n" );return -1 ; + } pde->proc_fops = &nfqueue_file_ops;#endif return 0 ;
net/rxrpc/proc.c +12 -4
@@ -139,26 +139,34 @@ int rxrpc_proc_init(void) proc_rxrpc->owner =THIS_MODULE ; p =create_proc_entry ("calls" ,0 , proc_rxrpc); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'calls' proc entry.\n" ); goto error_proc; + } p->proc_fops = &rxrpc_proc_calls_fops; p->owner =THIS_MODULE ; p =create_proc_entry ("connections" ,0 , proc_rxrpc); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'connections' proc entry.\n" ); goto error_calls; + } p->proc_fops = &rxrpc_proc_conns_fops; p->owner =THIS_MODULE ; p =create_proc_entry ("peers" ,0 , proc_rxrpc); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'peers' proc entry.\n" ); goto error_calls; + } p->proc_fops = &rxrpc_proc_peers_fops; p->owner =THIS_MODULE ; p =create_proc_entry ("transports" ,0 , proc_rxrpc); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'transports' proc entry.\n" ); goto error_conns; + } p->proc_fops = &rxrpc_proc_transports_fops; p->owner =THIS_MODULE ;
net/sctp/proc.c +9 -3
@@ -113,8 +113,10 @@ int __init sctp_snmp_proc_init(void)struct proc_dir_entry *p; p =create_proc_entry ("snmp" ,S_IRUGO , proc_net_sctp); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'snmp' proc entry.\n" );return -ENOMEM ; + } p->proc_fops = &sctp_snmp_seq_fops;
@@ -262,8 +264,10 @@ int __init sctp_eps_proc_init(void)struct proc_dir_entry *p; p =create_proc_entry ("eps" ,S_IRUGO , proc_net_sctp); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'eps' proc entry.\n" );return -ENOMEM ; + } p->proc_fops = &sctp_eps_seq_fops;
@@ -372,8 +376,10 @@ int __init sctp_assocs_proc_init(void)struct proc_dir_entry *p; p =create_proc_entry ("assocs" ,S_IRUGO , proc_net_sctp); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'assocs' proc entry.\n" );return -ENOMEM ; + } p->proc_fops = &sctp_assocs_seq_fops;
net/sunrpc/cache.c +6 -3
@@ -302,7 +302,8 @@ void cache_register(struct cache_detail p->proc_fops = &cache_flush_operations; p->owner = cd->owner; p->data = cd; - } + }else +printk (KERN_WARNING "Unable to create 'flush' proc entry.\n" );if (cd->cache_request || cd->cache_parse) { p = create_proc_entry("channel", S_IFREG|S_IRUSR|S_IWUSR,
@@ -312,7 +313,8 @@ void cache_register(struct cache_detail p->proc_fops = &cache_file_operations; p->owner = cd->owner; p->data = cd; - } + }else +printk (KERN_WARNING "Unable to create 'channel' proc entry.\n" ); }if (cd->cache_show) { p = create_proc_entry("content", S_IFREG|S_IRUSR|S_IWUSR,
@@ -322,7 +324,8 @@ void cache_register(struct cache_detail p->proc_fops = &content_file_operations; p->owner = cd->owner; p->data = cd; - } + }else +printk (KERN_WARNING "Unable to create 'content' proc entry.\n" ); } }rwlock_init (&cd->hash_lock);
net/sunrpc/stats.c +3 -1
@@ -232,7 +232,9 @@ do_register(const char *name, void *dataif (ent) { ent->proc_fops = fops; ent->data = data; - } + }else +printk (KERN_ERR "Unable to create '%s' proc entry.\n" , name); +return ent; }
net/wanrouter/wanproc.c +9 -3
@@ -292,12 +292,16 @@ int __init wanrouter_proc_init(void) goto fail; p =create_proc_entry ("config" ,S_IRUGO , proc_router); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'config' proc entry.\n" ); goto fail_config; + } p->proc_fops = &config_fops; p =create_proc_entry ("status" ,S_IRUGO , proc_router); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'status' proc entry.\n" ); goto fail_stat; + } p->proc_fops = &status_fops;return 0 ; fail_stat:
@@ -329,8 +333,10 @@ int wanrouter_proc_add(struct wan_devicereturn -EINVAL ; wandev->dent =create_proc_entry (wandev->name,S_IRUGO , proc_router); -if (!wandev->dent) +if (!wandev->dent) { +printk (KERN_ERR "Unable to create '%s' proc entry.\n" , wandev->name);return -ENOMEM ; + } wandev->dent->proc_fops = &wandev_fops; wandev->dent->data = wandev;return 0 ;
net/x25/x25_proc.c +6 -2
@@ -217,13 +217,17 @@ int __init x25_proc_init(void) goto out; p =create_proc_entry ("route" ,S_IRUGO , x25_proc_dir); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'route' proc entry.\n" ); goto out_route; + } p->proc_fops = &x25_seq_route_fops; p =create_proc_entry ("socket" ,S_IRUGO , x25_proc_dir); -if (!p) +if (!p) { +printk (KERN_ERR "Unable to create 'socket' proc entry.\n" ); goto out_socket; + } p->proc_fops = &x25_seq_socket_fops; rc =0 ; out:
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors