From 4defb5f912a0ba60e07e91a4b62634814cd99b7f Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Fri, 2 Dec 2016 15:18:06 +0000 Subject: orangefs: fix memory leak of string 'new' on exit path allocates string 'new' is not free'd on the exit path when cdm_element_count <= 0. Fix this by kfree'ing it. Fixes CoverityScan CID#1375923 "Resource Leak" Signed-off-by: Colin Ian King Signed-off-by: Mike Marshall --- fs/orangefs/orangefs-debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'fs/orangefs') diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c index 38887cc5577f..b5dbc9c6530c 100644 --- a/fs/orangefs/orangefs-debugfs.c +++ b/fs/orangefs/orangefs-debugfs.c @@ -671,8 +671,10 @@ int orangefs_prepare_debugfs_help_string(int at_boot) */ cdm_element_count = orangefs_prepare_cdm_array(client_debug_array_string); - if (cdm_element_count <= 0) + if (cdm_element_count <= 0) { + kfree(new); goto out; + } for (i = 0; i < cdm_element_count; i++) { strlcat(new, "\t", string_size); -- cgit v1.2.3 From 04102c76a779f1c4cec4f0fb51cacc360117b522 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Mon, 21 Nov 2016 23:17:02 +0100 Subject: orangefs: Axe some dead code The "perf_counter_reset" case has already been handled above. Moreover "ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE" is not a really consistent. It is likely that this (dead) code is a cut and paste left over. Signed-off-by: Christophe JAILLET Reviewed-by: Martin Brandenburg Signed-off-by: Mike Marshall --- fs/orangefs/orangefs-sysfs.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'fs/orangefs') diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c index a799546a67f7..084954448f18 100644 --- a/fs/orangefs/orangefs-sysfs.c +++ b/fs/orangefs/orangefs-sysfs.c @@ -609,15 +609,6 @@ static ssize_t sysfs_service_op_store(struct kobject *kobj, new_op->upcall.req.param.u.value32[0] = val1; new_op->upcall.req.param.u.value32[1] = val2; goto value_set; - } else if (!strcmp(attr->attr.name, - "perf_counter_reset")) { - if ((val > 0)) { - new_op->upcall.req.param.op = - ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE; - } else { - rc = 0; - goto out; - } } } else if (!strcmp(kobj->name, ACACHE_KOBJ_ID)) { -- cgit v1.2.3