diff options
| author | Alexander A. Klimov <grandmaster@al2klimov.de> | 2026-06-06 14:38:10 +0200 |
|---|---|---|
| committer | Maíra Canal <mcanal@igalia.com> | 2026-06-09 15:29:57 -0300 |
| commit | 5d563a5da8717629ae72f9eadf1e0e340bd1658b (patch) | |
| tree | fa21660ed467b9d33e579e9ab404e0e83c424cb5 /arch/nds32/kernel/git@git.tavy.me:linux.git | |
| parent | f329e8325e054bd6d84d10904f8dd51137281b92 (diff) | |
drm/vc4: fix krealloc() memory leak
Don't just overwrite the original pointer passed to krealloc()
with its return value without checking latter:
MEM = krealloc(MEM, SZ, GFP);
If krealloc() returns NULL, that erases the pointer
to the still allocated memory, hence leaks this memory.
Instead, use a temporary variable, check it's not NULL
and only then assign it to the original pointer:
TMP = krealloc(MEM, SZ, GFP);
if (!TMP) return;
MEM = TMP;
While on it, use krealloc_array().
Fixes: 6d45c81d229d ("drm/vc4: Add support for branching in shader validation.")
Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Link: https://patch.msgid.link/20260606123817.37222-1-grandmaster@al2klimov.de
Diffstat (limited to 'arch/nds32/kernel/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
