diff options
author | Nathan Lynch <[email protected]> | 2023-03-06 15:33:41 -0600 |
---|---|---|
committer | Michael Ellerman <[email protected]> | 2023-03-30 23:36:34 +1100 |
commit | 271208ee5e335cb1ad280d22784940daf7ddf820 (patch) | |
tree | 4ebd3b86a0f8fade95a5901d92c45ebae012e2d6 /tools/perf/scripts/python/syscall-counts.py | |
parent | f40b0f6c5c27de167fdd10e541e0a4b5f2bc772b (diff) |
powerpc/rtas: use memmove for potentially overlapping buffer copy
Using memcpy() isn't safe when buf is identical to rtas_err_buf, which
can happen during boot before slab is up. Full context which may not
be obvious from the diff:
if (altbuf) {
buf = altbuf;
} else {
buf = rtas_err_buf;
if (slab_is_available())
buf = kmalloc(RTAS_ERROR_LOG_MAX, GFP_ATOMIC);
}
if (buf)
memcpy(buf, rtas_err_buf, RTAS_ERROR_LOG_MAX);
This was found by inspection and I'm not aware of it causing problems
in practice. It appears to have been introduced by commit
033ef338b6e0 ("powerpc: Merge rtas.c into arch/powerpc/kernel"); the
old ppc64 version of this code did not have this problem.
Use memmove() instead.
Fixes: 033ef338b6e0 ("powerpc: Merge rtas.c into arch/powerpc/kernel")
Signed-off-by: Nathan Lynch <[email protected]>
Reviewed-by: Andrew Donnellan <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]
Diffstat (limited to 'tools/perf/scripts/python/syscall-counts.py')
0 files changed, 0 insertions, 0 deletions