From fe868356339182f0aa21a4424f5ef08229f8ebd6 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Mon, 5 Jun 2017 14:35:07 +0530 Subject: gpu: nvgpu: fix resource leak We pass (struct device_attribute *) to gp10b_ecc_stat_create() and gr_gp10b_ecc_stat_create() and then assign a memory allocation to this pointer But since this pointer is local copy to function, static pointer variables are never set in gr_gp10b_create_sysfs() This also results in a resource leak since we never free the storage assigned to local variable Fix this by adding correct parameter (struct device_attribute **) so that the address of the allocation is returned to the caller correctly Bug 200291879 Coverity id : 2567934 Change-Id: I7ac79810d9e22a568ae3cd1a69eb3f59a8d356ac Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1495905 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Sachin Nikam Reviewed-by: svccoveritychecker --- drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h') diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h index fb69fa98..74db60d1 100644 --- a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h @@ -23,13 +23,13 @@ int gr_gp10b_ecc_stat_create(struct device *dev, int is_l2, char *ecc_stat_name, struct gk20a_ecc_stat *ecc_stat, - struct device_attribute *dev_attr_array); + struct device_attribute **dev_attr_array); int gp10b_ecc_stat_create(struct device *dev, int hw_units, char *ecc_unit_name, char *ecc_stat_name, struct gk20a_ecc_stat *ecc_stat, - struct device_attribute *dev_attr_array); + struct device_attribute **dev_attr_array); void gr_gp10b_ecc_stat_remove(struct device *dev, int is_l2, -- cgit v1.2.2