kernel-ark/fs/pstore
Anton Vorontsov a384f64117 pstore/ram: Fix possible NULL dereference
We can dereference 'cxt->cprz' if console and dump logging are disabled
(which is unlikely, but still possible to do). This patch fixes the issue
by changing the code so that we don't dereference przs at all, we can
just calculate bufsize from console_size and record_size values.

Plus, while at it, the patch improves the buffer size calculation.

After Kay's printk rework, we know the optimal buffer size for console
logging -- it is LOG_LINE_MAX (defined privately in printk.c). Previously,
if only console logging was enabled, we would allocate unnecessary large
buffer in pstore, while we only need LOG_LINE_MAX. (Pstore console logging
is still capable of handling buffers > LOG_LINE_MAX, it will just do
multiple calls to psinfo->write).

Note that I don't export the constant, since we will do even a better
thing soon: we will switch console logging to a new write_buf API, which
will eliminate the need for the additional buffer; and so we won't need
the constant.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: Kees Cook <keescook@chromium.org>
2012-08-04 16:16:43 -07:00
..
ftrace.c pstore: Add persistent function tracing 2012-07-17 10:05:52 -07:00
inode.c pstore: Add persistent function tracing 2012-07-17 10:05:52 -07:00
internal.h pstore: Headers should include all stuff they use 2012-07-17 12:15:30 -07:00
Kconfig pstore: Add persistent function tracing 2012-07-17 10:05:52 -07:00
Makefile pstore: Add persistent function tracing 2012-07-17 10:05:52 -07:00
platform.c pstore: Add persistent function tracing 2012-07-17 10:05:52 -07:00
ram_core.c pstore/ram: Make tracing log versioned 2012-07-17 16:48:09 -07:00
ram.c pstore/ram: Fix possible NULL dereference 2012-08-04 16:16:43 -07:00