Commit 8cf5dd2
EDAC/versalnet: Fix device name memory leak
The device name allocated via kzalloc() in init_one_mc() is assigned to
dev->init_name but never freed on the normal removal path. device_register()
copies init_name and then sets dev->init_name to NULL, so the name pointer
becomes unreachable from the device. Thus leaking memory.
Use a stack-local char array instead of using kzalloc() for name.
Fixes: d5fe2fe ("EDAC: Add a driver for the AMD Versal NET DDR controller")
Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260401111856.2342975-1-ptsm@linux.microsoft.com1 parent 7fd2df2 commit 8cf5dd2
1 file changed
Lines changed: 2 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
777 | 777 | | |
778 | 778 | | |
779 | 779 | | |
| 780 | + | |
780 | 781 | | |
781 | 782 | | |
782 | | - | |
783 | 783 | | |
784 | 784 | | |
785 | 785 | | |
| |||
813 | 813 | | |
814 | 814 | | |
815 | 815 | | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | 816 | | |
821 | 817 | | |
822 | | - | |
| 818 | + | |
823 | 819 | | |
824 | 820 | | |
825 | 821 | | |
| |||
858 | 854 | | |
859 | 855 | | |
860 | 856 | | |
861 | | - | |
862 | | - | |
863 | 857 | | |
864 | 858 | | |
865 | 859 | | |
| |||
0 commit comments