Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1248881

[PATCH 1/3] pstore: add vmalloc error check

From Geliang Tang <geliangtang@163.com>
Newsgroups linux.kernel
Subject [PATCH 1/3] pstore: add vmalloc error check
Date 2015-10-16 17:30 +0200
Message-ID <qkf7d-1SN-51@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


If vmalloc is failed, return -ENOMEM.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Kees Cook <keescook@chromium.org>
---
 Send it again.
---
 fs/pstore/pmsg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/pstore/pmsg.c b/fs/pstore/pmsg.c
index feb5dd2..5a2f05a 100644
--- a/fs/pstore/pmsg.c
+++ b/fs/pstore/pmsg.c
@@ -37,6 +37,8 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf,
 	if (buffer_size > PMSG_MAX_BOUNCE_BUFFER_SIZE)
 		buffer_size = PMSG_MAX_BOUNCE_BUFFER_SIZE;
 	buffer = vmalloc(buffer_size);
+	if (!buffer)
+		return -ENOMEM;
 
 	mutex_lock(&pmsg_lock);
 	for (i = 0; i < count; ) {
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] pstore: add vmalloc error check Geliang Tang <geliangtang@163.com> - 2015-10-16 17:30 +0200
  [PATCH 3/3] pstore: add 'rmmod ramoops' support Geliang Tang <geliangtang@163.com> - 2015-10-16 17:30 +0200
    Re: [PATCH 3/3] pstore: add 'rmmod ramoops' support Kees Cook <keescook@chromium.org> - 2015-10-16 18:00 +0200
  [PATCH 2/3] pstore: add a helper function pstore_register_kmsg Geliang Tang <geliangtang@163.com> - 2015-10-16 17:40 +0200

csiph-web