Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75e300c8 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents c13e69b2 ebacfd1e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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 = {};
+31 −11
Original line number Diff line number Diff line
@@ -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,7 +291,8 @@ static void ramoops_free_przs(struct ramoops_context *cxt)
	kfree(cxt->przs);
}

static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
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;
@@ -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 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
	return err;
}

static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
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,9 +389,13 @@ static int __devinit ramoops_probe(struct platform_device *pdev)
		goto fail_out;
	}

	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;