aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pstore/ram_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/pstore/ram_core.c')
-rw-r--r--fs/pstore/ram_core.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 4dabbb8e4270..eecd2a8a84dd 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -391,7 +391,7 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size,
391} 391}
392 392
393static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz, 393static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz,
394 int ecc_size) 394 u32 sig, int ecc_size)
395{ 395{
396 int ret; 396 int ret;
397 397
@@ -399,7 +399,9 @@ static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz,
399 if (ret) 399 if (ret)
400 return ret; 400 return ret;
401 401
402 if (prz->buffer->sig == PERSISTENT_RAM_SIG) { 402 sig ^= PERSISTENT_RAM_SIG;
403
404 if (prz->buffer->sig == sig) {
403 if (buffer_size(prz) > prz->buffer_size || 405 if (buffer_size(prz) > prz->buffer_size ||
404 buffer_start(prz) > buffer_size(prz)) 406 buffer_start(prz) > buffer_size(prz))
405 pr_info("persistent_ram: found existing invalid buffer," 407 pr_info("persistent_ram: found existing invalid buffer,"
@@ -417,7 +419,7 @@ static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz,
417 " (sig = 0x%08x)\n", prz->buffer->sig); 419 " (sig = 0x%08x)\n", prz->buffer->sig);
418 } 420 }
419 421
420 prz->buffer->sig = PERSISTENT_RAM_SIG; 422 prz->buffer->sig = sig;
421 persistent_ram_zap(prz); 423 persistent_ram_zap(prz);
422 424
423 return 0; 425 return 0;
@@ -442,7 +444,7 @@ void persistent_ram_free(struct persistent_ram_zone *prz)
442} 444}
443 445
444struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, 446struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start,
445 size_t size, 447 size_t size, u32 sig,
446 int ecc_size) 448 int ecc_size)
447{ 449{
448 struct persistent_ram_zone *prz; 450 struct persistent_ram_zone *prz;
@@ -458,7 +460,7 @@ struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start,
458 if (ret) 460 if (ret)
459 goto err; 461 goto err;
460 462
461 ret = persistent_ram_post_init(prz, ecc_size); 463 ret = persistent_ram_post_init(prz, sig, ecc_size);
462 if (ret) 464 if (ret)
463 goto err; 465 goto err;
464 466