pstore: Add buffer start check during init

The missing check to prz->start can cause crash because it
can be any value and used to locate the write position, so
add the start check to avoid.

Change-Id: If8ed4db8d9dafab656dd5793aed597463fab628d
Signed-off-by: Huang Yiwei <hyiwei@codeaurora.org>
This commit is contained in:
Huang Yiwei 2020-12-10 15:38:51 +08:00
commit 87d5e4a8c3

View file

@ -507,7 +507,7 @@ static int persistent_ram_post_init(struct persistent_ram_zone *prz, u32 sig,
sig ^= PERSISTENT_RAM_SIG;
if (prz->buffer->sig == sig) {
if (buffer_size(prz) == 0) {
if (buffer_size(prz) == 0 && buffer_start(prz) == 0) {
pr_debug("found existing empty buffer\n");
return 0;
}