From 965b658f73ff2a6d11198edc1b84a06a900c1fd7 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 9 Dec 2009 10:38:15 -0600 Subject: [PATCH] PR 10848 partial fix by using systemtap memory functions everywhere. * runtime/addr-map.c (add_bad_addr_entry): Uses systemtap memory allocation/deallocation wrappers. * runtime/itrace.c (create_itrace_info): Ditto. (remove_usr_itrace_info): Ditto. --- runtime/addr-map.c | 11 +++++------ runtime/itrace.c | 9 +++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/runtime/addr-map.c b/runtime/addr-map.c index 35de7a642..abb723f38 100644 --- a/runtime/addr-map.c +++ b/runtime/addr-map.c @@ -163,12 +163,11 @@ add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr, spin_unlock(&addr_map_lock); if (new_map) { - kfree(new_map); + _stp_kfree(new_map); new_map = 0; } - new_map = kmalloc(sizeof(*new_map) - + sizeof(*new_entry) * (old_size + 1), - GFP_KERNEL); + new_map = _stp_kmalloc(sizeof(*new_map) + + sizeof(*new_entry) * (old_size + 1)); if (!new_map) return -ENOMEM; new_map->size = old_size + 1; @@ -191,7 +190,7 @@ add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr, if (existing_max) *existing_max = max_entry; spin_unlock(&addr_map_lock); - kfree(new_map); + _stp_kfree(new_map); return 1; } existing = upper_bound(min_addr, old_map); @@ -210,7 +209,7 @@ add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr, blackmap = new_map; spin_unlock(&addr_map_lock); if (old_map) - kfree(old_map); + _stp_kfree(old_map); return 0; } diff --git a/runtime/itrace.c b/runtime/itrace.c index f2ed86f2c..5b2437a42 100644 --- a/runtime/itrace.c +++ b/runtime/itrace.c @@ -219,7 +219,12 @@ static struct itrace_info *create_itrace_info( if (debug) printk(KERN_INFO "create_itrace_info: tid=%d\n", tsk->pid); /* initialize ui */ - ui = kzalloc(sizeof(struct itrace_info), GFP_USER); + ui = _stp_kzalloc(sizeof(struct itrace_info)); + if (ui == NULL) { + printk(KERN_ERR "%s:%d: Unable to allocate memory\n", + __FUNCTION__, __LINE__); + return NULL; + } ui->tsk = tsk; ui->tid = tsk->pid; ui->step_flag = step_flag; @@ -329,7 +334,7 @@ void static remove_usr_itrace_info(struct itrace_info *ui) spin_lock(&itrace_lock); list_del(&ui->link); spin_unlock(&itrace_lock); - kfree(ui); + _stp_kfree(ui); } void static cleanup_usr_itrace(void) -- 2.43.5