projects/linux·commit c271bdbf

Merge tag 'pstore-v5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

c271bdbf · Linus Torvalds <[email protected]> · 2020-03-30 13:09:34 -07:00

Pull pstore updates from Kees Cook:
 "These mostly some minor cleanups and a bug fix for an ftrace corner
  case:

   - Improve failure paths (chenqiwu)

   - Fix ftrace position index (Vasily Averin)

   - Use proper flexible-array member (Gustavo A. R. Silva)"

* tag 'pstore-v5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  pstore/ram: Replace zero-length array with flexible-array member
  pstore: pstore_ftrace_seq_next should increase position index
  pstore/ram: remove unnecessary ramoops_unregister_dummy()
  pstore/platform: fix potential mem leak if pstore_init_fs failed
Commit
c271bdbf38e03ea0c19ce0041c1eaefb42227110
Parents
78b0dedd · 8128d3aa

Merge commit. Changes below are compared with the first parent: 78b0dedd.

Changes

4 files changed · +7 −5

FileStatusAddDelContent
fs/pstore/inode.cmodified+4−1View file
fs/pstore/platform.cmodified+2−2View file
fs/pstore/ram.cmodified+0−1View file
fs/pstore/ram_core.cmodified+1−1View file

fs/pstore/inode.c

View file
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 7fbe8f0..d99b5d3 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -87,11 +87,11 @@ static void *pstore_ftrace_seq_next(struct seq_file *s, void *v, loff_t *pos)
struct pstore_private *ps = s->private;
struct pstore_ftrace_seq_data *data = v;
+ (*pos)++;
data->off += REC_SIZE;
if (data->off + REC_SIZE > ps->total_size)
return NULL;
- (*pos)++;
return data;
}
@@ -101,6 +101,9 @@ static int pstore_ftrace_seq_show(struct seq_file *s, void *v)
struct pstore_ftrace_seq_data *data = v;
struct pstore_ftrace_record *rec;
+ if (!data)
+ return 0;
+
rec = (struct pstore_ftrace_record *)(ps->record->buf + data->off);
seq_printf(s, "CPU:%d ts:%llu %08lx %08lx %ps <- %pS\n",

fs/pstore/platform.c

View file
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index d896457..408277e 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -823,9 +823,9 @@ static int __init pstore_init(void)
ret = pstore_init_fs();
if (ret)
- return ret;
+ free_buf_for_compression();
- return 0;
+ return ret;
}
late_initcall(pstore_init);

fs/pstore/ram.c

View file
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 013486b..7956221 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -963,7 +963,6 @@ static void __init ramoops_register_dummy(void)
pr_info("could not create platform device: %ld\n",
PTR_ERR(dummy));
dummy = NULL;
- ramoops_unregister_dummy();
}
}

fs/pstore/ram_core.c

View file
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 1f4d8c0..c917c19 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -34,7 +34,7 @@ struct persistent_ram_buffer {
uint32_t sig;
atomic_t start;
atomic_t size;
- uint8_t data[0];
+ uint8_t data[];
};
#define PERSISTENT_RAM_SIG (0x43474244) /* DBGC */