diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-15 15:51:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-15 15:51:50 -0500 |
commit | 75e300c8ba5864367634d946c729d8fd05c1cbc2 (patch) | |
tree | 2ccbc619f482d453d18e5162649e3c2e7162673c /fs/pstore | |
parent | c13e69b2f0e1e2da41a175c7e9215659842cbef9 (diff) | |
parent | ebacfd1ece3bfa46296fc92c6f996cb5f7fc75e6 (diff) |
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
Diffstat (limited to 'fs/pstore')
-rw-r--r-- | fs/pstore/ftrace.c | 4 | ||||
-rw-r--r-- | fs/pstore/ram.c | 42 |
2 files changed, 34 insertions, 12 deletions
diff --git a/fs/pstore/ftrace.c b/fs/pstore/ftrace.c index 2d57e1ac0115..43b12807a51d 100644 --- a/fs/pstore/ftrace.c +++ b/fs/pstore/ftrace.c | |||
@@ -28,7 +28,9 @@ | |||
28 | #include "internal.h" | 28 | #include "internal.h" |
29 | 29 | ||
30 | static void notrace pstore_ftrace_call(unsigned long ip, | 30 | static void notrace pstore_ftrace_call(unsigned long ip, |
31 | unsigned long parent_ip) | 31 | unsigned long parent_ip, |
32 | struct ftrace_ops *op, | ||
33 | struct pt_regs *regs) | ||
32 | { | 34 | { |
33 | unsigned long flags; | 35 | unsigned long flags; |
34 | struct pstore_ftrace_record rec = {}; | 36 | struct pstore_ftrace_record rec = {}; |
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 2bfa36e0ffe8..f883e7e74305 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c | |||
@@ -188,7 +188,7 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type, | |||
188 | struct pstore_info *psi) | 188 | struct pstore_info *psi) |
189 | { | 189 | { |
190 | struct ramoops_context *cxt = psi->data; | 190 | struct ramoops_context *cxt = psi->data; |
191 | struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt]; | 191 | struct persistent_ram_zone *prz; |
192 | size_t hlen; | 192 | size_t hlen; |
193 | 193 | ||
194 | if (type == PSTORE_TYPE_CONSOLE) { | 194 | if (type == PSTORE_TYPE_CONSOLE) { |
@@ -225,6 +225,11 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type, | |||
225 | if (part != 1) | 225 | if (part != 1) |
226 | return -ENOSPC; | 226 | return -ENOSPC; |
227 | 227 | ||
228 | if (!cxt->przs) | ||
229 | return -ENOSPC; | ||
230 | |||
231 | prz = cxt->przs[cxt->dump_write_cnt]; | ||
232 | |||
228 | hlen = ramoops_write_kmsg_hdr(prz); | 233 | hlen = ramoops_write_kmsg_hdr(prz); |
229 | if (size + hlen > prz->buffer_size) | 234 | if (size + hlen > prz->buffer_size) |
230 | size = prz->buffer_size - hlen; | 235 | size = prz->buffer_size - hlen; |
@@ -286,8 +291,9 @@ static void ramoops_free_przs(struct ramoops_context *cxt) | |||
286 | kfree(cxt->przs); | 291 | kfree(cxt->przs); |
287 | } | 292 | } |
288 | 293 | ||
289 | static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt, | 294 | static int __devinit ramoops_init_przs(struct device *dev, |
290 | phys_addr_t *paddr, size_t dump_mem_sz) | 295 | struct ramoops_context *cxt, |
296 | phys_addr_t *paddr, size_t dump_mem_sz) | ||
291 | { | 297 | { |
292 | int err = -ENOMEM; | 298 | int err = -ENOMEM; |
293 | int i; | 299 | int i; |
@@ -295,6 +301,11 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt, | |||
295 | if (!cxt->record_size) | 301 | if (!cxt->record_size) |
296 | return 0; | 302 | return 0; |
297 | 303 | ||
304 | if (*paddr + dump_mem_sz - cxt->phys_addr > cxt->size) { | ||
305 | dev_err(dev, "no room for dumps\n"); | ||
306 | return -ENOMEM; | ||
307 | } | ||
308 | |||
298 | cxt->max_dump_cnt = dump_mem_sz / cxt->record_size; | 309 | cxt->max_dump_cnt = dump_mem_sz / cxt->record_size; |
299 | if (!cxt->max_dump_cnt) | 310 | if (!cxt->max_dump_cnt) |
300 | return -ENOMEM; | 311 | return -ENOMEM; |
@@ -325,15 +336,20 @@ fail_prz: | |||
325 | return err; | 336 | return err; |
326 | } | 337 | } |
327 | 338 | ||
328 | static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt, | 339 | static int __devinit ramoops_init_prz(struct device *dev, |
329 | struct persistent_ram_zone **prz, | 340 | struct ramoops_context *cxt, |
330 | phys_addr_t *paddr, size_t sz, u32 sig) | 341 | struct persistent_ram_zone **prz, |
342 | phys_addr_t *paddr, size_t sz, u32 sig) | ||
331 | { | 343 | { |
332 | if (!sz) | 344 | if (!sz) |
333 | return 0; | 345 | return 0; |
334 | 346 | ||
335 | if (*paddr + sz > *paddr + cxt->size) | 347 | if (*paddr + sz - cxt->phys_addr > cxt->size) { |
348 | dev_err(dev, "no room for mem region (0x%zx@0x%llx) in (0x%lx@0x%llx)\n", | ||
349 | sz, (unsigned long long)*paddr, | ||
350 | cxt->size, (unsigned long long)cxt->phys_addr); | ||
336 | return -ENOMEM; | 351 | return -ENOMEM; |
352 | } | ||
337 | 353 | ||
338 | *prz = persistent_ram_new(*paddr, sz, sig, cxt->ecc_size); | 354 | *prz = persistent_ram_new(*paddr, sz, sig, cxt->ecc_size); |
339 | if (IS_ERR(*prz)) { | 355 | if (IS_ERR(*prz)) { |
@@ -373,10 +389,14 @@ static int __devinit ramoops_probe(struct platform_device *pdev) | |||
373 | goto fail_out; | 389 | goto fail_out; |
374 | } | 390 | } |
375 | 391 | ||
376 | pdata->mem_size = rounddown_pow_of_two(pdata->mem_size); | 392 | if (!is_power_of_2(pdata->mem_size)) |
377 | pdata->record_size = rounddown_pow_of_two(pdata->record_size); | 393 | pdata->mem_size = rounddown_pow_of_two(pdata->mem_size); |
378 | pdata->console_size = rounddown_pow_of_two(pdata->console_size); | 394 | if (!is_power_of_2(pdata->record_size)) |
379 | pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size); | 395 | pdata->record_size = rounddown_pow_of_two(pdata->record_size); |
396 | if (!is_power_of_2(pdata->console_size)) | ||
397 | pdata->console_size = rounddown_pow_of_two(pdata->console_size); | ||
398 | if (!is_power_of_2(pdata->ftrace_size)) | ||
399 | pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size); | ||
380 | 400 | ||
381 | cxt->dump_read_cnt = 0; | 401 | cxt->dump_read_cnt = 0; |
382 | cxt->size = pdata->mem_size; | 402 | cxt->size = pdata->mem_size; |