diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-06-05 05:05:07 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-06-06 11:13:43 -0400 |
commit | fe868356339182f0aa21a4424f5ef08229f8ebd6 (patch) | |
tree | 2eb8f340e882adb278bc352ecac0af75120ab6af /drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h | |
parent | d4fcf90047fcf5f576801b8c1cfbca5b9ac44844 (diff) |
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 <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1495905
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h')
-rw-r--r-- | drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h | 4 |
1 files changed, 2 insertions, 2 deletions
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, | |||
23 | int is_l2, | 23 | int is_l2, |
24 | char *ecc_stat_name, | 24 | char *ecc_stat_name, |
25 | struct gk20a_ecc_stat *ecc_stat, | 25 | struct gk20a_ecc_stat *ecc_stat, |
26 | struct device_attribute *dev_attr_array); | 26 | struct device_attribute **dev_attr_array); |
27 | int gp10b_ecc_stat_create(struct device *dev, | 27 | int gp10b_ecc_stat_create(struct device *dev, |
28 | int hw_units, | 28 | int hw_units, |
29 | char *ecc_unit_name, | 29 | char *ecc_unit_name, |
30 | char *ecc_stat_name, | 30 | char *ecc_stat_name, |
31 | struct gk20a_ecc_stat *ecc_stat, | 31 | struct gk20a_ecc_stat *ecc_stat, |
32 | struct device_attribute *dev_attr_array); | 32 | struct device_attribute **dev_attr_array); |
33 | 33 | ||
34 | void gr_gp10b_ecc_stat_remove(struct device *dev, | 34 | void gr_gp10b_ecc_stat_remove(struct device *dev, |
35 | int is_l2, | 35 | int is_l2, |