Re: [PATCH v2 2/3] regmap: debugfs: Fix kmemleak in regmap_debugfs_init
Hi Mark, Thanks for your reply. On 03/06/2018 08:59 PM, Mark Brown wrote: On Tue, Mar 06, 2018 at 07:04:02PM +0800, Jeffy Chen wrote: Use map->debugfs_name to store allocated debugfs name, so it would be freed in regmap_debugfs_exit(). I'm missing patch 1 in this series and I think this collides with a fix I already have locally. sorry for that, i should CC you the whole seires. the patch 1 should be: https://patchwork.kernel.org/patch/10261413
Re: [PATCH v2 2/3] regmap: debugfs: Fix kmemleak in regmap_debugfs_init
Hi Mark, Thanks for your reply. On 03/06/2018 08:59 PM, Mark Brown wrote: On Tue, Mar 06, 2018 at 07:04:02PM +0800, Jeffy Chen wrote: Use map->debugfs_name to store allocated debugfs name, so it would be freed in regmap_debugfs_exit(). I'm missing patch 1 in this series and I think this collides with a fix I already have locally. sorry for that, i should CC you the whole seires. the patch 1 should be: https://patchwork.kernel.org/patch/10261413
Re: [PATCH v2 2/3] regmap: debugfs: Fix kmemleak in regmap_debugfs_init
On Tue, Mar 06, 2018 at 07:04:02PM +0800, Jeffy Chen wrote: > Use map->debugfs_name to store allocated debugfs name, so it would be > freed in regmap_debugfs_exit(). I'm missing patch 1 in this series and I think this collides with a fix I already have locally. signature.asc Description: PGP signature
Re: [PATCH v2 2/3] regmap: debugfs: Fix kmemleak in regmap_debugfs_init
On Tue, Mar 06, 2018 at 07:04:02PM +0800, Jeffy Chen wrote: > Use map->debugfs_name to store allocated debugfs name, so it would be > freed in regmap_debugfs_exit(). I'm missing patch 1 in this series and I think this collides with a fix I already have locally. signature.asc Description: PGP signature
[PATCH v2 2/3] regmap: debugfs: Fix kmemleak in regmap_debugfs_init
Use map->debugfs_name to store allocated debugfs name, so it would be freed in regmap_debugfs_exit(). Kmemleak reported: unreferenced object 0xffc0cf78cf00 (size 128): comm "swapper/0", pid 1, jiffies 4294669168 (age 89.152s) hex dump (first 32 bytes): 64 75 6d 6d 79 32 33 00 00 00 00 00 00 00 00 00 dummy23. 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 backtrace: [<27429160>] kmemleak_alloc+0x58/0x8c [<81861ddf>] __kmalloc_track_caller+0x1dc/0x2bc [<258a341f>] kvasprintf+0xd0/0x168 [] kasprintf+0xac/0xd8 [<5f585642>] regmap_debugfs_init+0x1a0/0x3b0 [<2c08b110>] __regmap_init+0x12b8/0x135c [ ] __regmap_init_mmio_clk+0x70/0x84 [<9c8f06b5>] of_syscon_register+0x278/0x378 [<87e6c121>] syscon_node_to_regmap+0x80/0xb0 Fixes: a430ab205d29 ("regmap: debugfs: Disambiguate dummy debugfs file name") Signed-off-by: Jeffy Chen --- drivers/base/regmap/regmap-debugfs.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index e3e7b91cc421..5479a183248f 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c @@ -570,15 +570,15 @@ void regmap_debugfs_init(struct regmap *map, const char *name) map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s", devname, name); name = map->debugfs_name; + } else if (!map->dev) { + map->debugfs_name = kasprintf(GFP_KERNEL, "%s%d", + devname, dummy_index); + name = map->debugfs_name; + dummy_index++; } else { name = devname; } - if (!strcmp(name, "dummy")) { - name = kasprintf(GFP_KERNEL, "dummy%d", dummy_index); - dummy_index++; - } - map->debugfs = debugfs_create_dir(name, regmap_debugfs_root); if (!map->debugfs) { dev_warn(map->dev, "Failed to create debugfs directory\n"); -- 2.11.0
[PATCH v2 2/3] regmap: debugfs: Fix kmemleak in regmap_debugfs_init
Use map->debugfs_name to store allocated debugfs name, so it would be freed in regmap_debugfs_exit(). Kmemleak reported: unreferenced object 0xffc0cf78cf00 (size 128): comm "swapper/0", pid 1, jiffies 4294669168 (age 89.152s) hex dump (first 32 bytes): 64 75 6d 6d 79 32 33 00 00 00 00 00 00 00 00 00 dummy23. 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 backtrace: [<27429160>] kmemleak_alloc+0x58/0x8c [<81861ddf>] __kmalloc_track_caller+0x1dc/0x2bc [<258a341f>] kvasprintf+0xd0/0x168 [] kasprintf+0xac/0xd8 [<5f585642>] regmap_debugfs_init+0x1a0/0x3b0 [<2c08b110>] __regmap_init+0x12b8/0x135c [ ] __regmap_init_mmio_clk+0x70/0x84 [<9c8f06b5>] of_syscon_register+0x278/0x378 [<87e6c121>] syscon_node_to_regmap+0x80/0xb0 Fixes: a430ab205d29 ("regmap: debugfs: Disambiguate dummy debugfs file name") Signed-off-by: Jeffy Chen --- drivers/base/regmap/regmap-debugfs.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index e3e7b91cc421..5479a183248f 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c @@ -570,15 +570,15 @@ void regmap_debugfs_init(struct regmap *map, const char *name) map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s", devname, name); name = map->debugfs_name; + } else if (!map->dev) { + map->debugfs_name = kasprintf(GFP_KERNEL, "%s%d", + devname, dummy_index); + name = map->debugfs_name; + dummy_index++; } else { name = devname; } - if (!strcmp(name, "dummy")) { - name = kasprintf(GFP_KERNEL, "dummy%d", dummy_index); - dummy_index++; - } - map->debugfs = debugfs_create_dir(name, regmap_debugfs_root); if (!map->debugfs) { dev_warn(map->dev, "Failed to create debugfs directory\n"); -- 2.11.0