]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: kexec_file: Avoid temp buffer for RNG seed
authorGeorge Spelvin <lkml@SDF.ORG>
Mon, 30 Mar 2020 17:38:01 +0000 (17:38 +0000)
committerWill Deacon <will@kernel.org>
Tue, 28 Apr 2020 12:55:51 +0000 (13:55 +0100)
commite152fc7c21d02001e8865919ca8b330d1196a200
tree7715e2cea292b716d4042c947891333a6cadbd30
parente4118cd9b9d6e79c4bd8128ffeb8ed7a4545a19d
arm64: kexec_file: Avoid temp buffer for RNG seed

After using get_random_bytes(), you want to wipe the buffer
afterward so the seed remains secret.

In this case, we can eliminate the temporary buffer entirely.
fdt_setprop_placeholder() returns a pointer to the property value
buffer, allowing us to put the random data directly in there without
using a temporary buffer at all.  Faster and less stack all in one.

Signed-off-by: George Spelvin <lkml@sdf.org>
Acked-by: Will Deacon <will@kernel.org>
Cc: Hsin-Yi Wang <hsinyi@chromium.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20200330173801.GA9199@SDF.ORG
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/machine_kexec_file.c