forked from Minki/linux
Just a couple of fixes, nothing extraordinary.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAABAgAGBQJQyVFxAAoJEGgI9fZJve1bbJcQAJciSd1cb3e545sgUF4wjFXL RN/yYnlqytGGhEV/wSDMLrCCheReYeHL3nLnbG9MezF6dzmTik67xaQSjiZ5WvfY OoQKT816sWYV6S6POhBkNXGmPYxfP+A5fSpZeSFDGu5gXk+Gl0ytHS1X1sWOpRw+ cUUzB7D3+XbHrpFj23v7z++4A80hOtWHxrBfmdCX9JM0iP+0uiO+JLoO5Av0KhJw UU+lkmnlZRDQZuqKyAXO74V0Vu8Ze1u3a+aOuBRwLzFmomrBhdH3AHpBTTXc/nTh /mep23lr78pBsatemn3hDW1CH+41WmCeNWzxv2y9JJR6/MGV48QPzR6mFkPMKSf1 FiKSsge03/wQ0H6mDSXs9eV9g1+it47/hE8uSjh+ZvbiBHzwrE9v+t27jVu6wMa9 oWLYTqTQokHqUOvKKsXDx4pF/rF6sIRRytHybtmAHVYDbuyVLIsufro6FPKxGlpE z7zYciojWEQzsHweOC7mrQYqaJagReapObASF5G0vK5XFvSB87wwda5AXQHvHBq0 mawc2DP5HSlmcb7KGjaqYDBNJj1ueUzFNBbnMab+ITx/rzitM/henPL7VsmOKXrc HRM4TA7oYW+zZbkSdOL56CmLWcWBuwIVAhOk6Ax71PtvqNzLKu0Z/GBA+fWwzjOL bsxQJMYniu0Fvyh5VkYD =0rWI -----END PGP SIGNATURE----- Merge tag 'for-v3.8' of git://git.infradead.org/users/cbou/linux-pstore Pull pstore update from Anton Vorontsov: "Here are just a few fixups for the pstore subsystem, nothing special this time" * tag 'for-v3.8' of git://git.infradead.org/users/cbou/linux-pstore: pstore/ftrace: Adjust for ftrace_ops->func prototype change pstore/ram: Fix bounds checks for mem_size, record_size, console_size and ftrace_size pstore/ram: Fix undefined usage of rounddown_pow_of_two(0) pstore/ram: Fixup section annotations
This commit is contained in:
commit
75e300c8ba
@ -28,7 +28,9 @@
|
||||
#include "internal.h"
|
||||
|
||||
static void notrace pstore_ftrace_call(unsigned long ip,
|
||||
unsigned long parent_ip)
|
||||
unsigned long parent_ip,
|
||||
struct ftrace_ops *op,
|
||||
struct pt_regs *regs)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct pstore_ftrace_record rec = {};
|
||||
|
@ -188,7 +188,7 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
|
||||
struct pstore_info *psi)
|
||||
{
|
||||
struct ramoops_context *cxt = psi->data;
|
||||
struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt];
|
||||
struct persistent_ram_zone *prz;
|
||||
size_t hlen;
|
||||
|
||||
if (type == PSTORE_TYPE_CONSOLE) {
|
||||
@ -225,6 +225,11 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
|
||||
if (part != 1)
|
||||
return -ENOSPC;
|
||||
|
||||
if (!cxt->przs)
|
||||
return -ENOSPC;
|
||||
|
||||
prz = cxt->przs[cxt->dump_write_cnt];
|
||||
|
||||
hlen = ramoops_write_kmsg_hdr(prz);
|
||||
if (size + hlen > prz->buffer_size)
|
||||
size = prz->buffer_size - hlen;
|
||||
@ -286,8 +291,9 @@ static void ramoops_free_przs(struct ramoops_context *cxt)
|
||||
kfree(cxt->przs);
|
||||
}
|
||||
|
||||
static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
|
||||
phys_addr_t *paddr, size_t dump_mem_sz)
|
||||
static int __devinit ramoops_init_przs(struct device *dev,
|
||||
struct ramoops_context *cxt,
|
||||
phys_addr_t *paddr, size_t dump_mem_sz)
|
||||
{
|
||||
int err = -ENOMEM;
|
||||
int i;
|
||||
@ -295,6 +301,11 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
|
||||
if (!cxt->record_size)
|
||||
return 0;
|
||||
|
||||
if (*paddr + dump_mem_sz - cxt->phys_addr > cxt->size) {
|
||||
dev_err(dev, "no room for dumps\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
cxt->max_dump_cnt = dump_mem_sz / cxt->record_size;
|
||||
if (!cxt->max_dump_cnt)
|
||||
return -ENOMEM;
|
||||
@ -325,15 +336,20 @@ fail_prz:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
|
||||
struct persistent_ram_zone **prz,
|
||||
phys_addr_t *paddr, size_t sz, u32 sig)
|
||||
static int __devinit ramoops_init_prz(struct device *dev,
|
||||
struct ramoops_context *cxt,
|
||||
struct persistent_ram_zone **prz,
|
||||
phys_addr_t *paddr, size_t sz, u32 sig)
|
||||
{
|
||||
if (!sz)
|
||||
return 0;
|
||||
|
||||
if (*paddr + sz > *paddr + cxt->size)
|
||||
if (*paddr + sz - cxt->phys_addr > cxt->size) {
|
||||
dev_err(dev, "no room for mem region (0x%zx@0x%llx) in (0x%lx@0x%llx)\n",
|
||||
sz, (unsigned long long)*paddr,
|
||||
cxt->size, (unsigned long long)cxt->phys_addr);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
*prz = persistent_ram_new(*paddr, sz, sig, cxt->ecc_size);
|
||||
if (IS_ERR(*prz)) {
|
||||
@ -373,10 +389,14 @@ static int __devinit ramoops_probe(struct platform_device *pdev)
|
||||
goto fail_out;
|
||||
}
|
||||
|
||||
pdata->mem_size = rounddown_pow_of_two(pdata->mem_size);
|
||||
pdata->record_size = rounddown_pow_of_two(pdata->record_size);
|
||||
pdata->console_size = rounddown_pow_of_two(pdata->console_size);
|
||||
pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size);
|
||||
if (!is_power_of_2(pdata->mem_size))
|
||||
pdata->mem_size = rounddown_pow_of_two(pdata->mem_size);
|
||||
if (!is_power_of_2(pdata->record_size))
|
||||
pdata->record_size = rounddown_pow_of_two(pdata->record_size);
|
||||
if (!is_power_of_2(pdata->console_size))
|
||||
pdata->console_size = rounddown_pow_of_two(pdata->console_size);
|
||||
if (!is_power_of_2(pdata->ftrace_size))
|
||||
pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size);
|
||||
|
||||
cxt->dump_read_cnt = 0;
|
||||
cxt->size = pdata->mem_size;
|
||||
|
Loading…
Reference in New Issue
Block a user