Commit 96027053 authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] missing sanity check in ppdev

parent e70f1205
...@@ -118,6 +118,10 @@ static ssize_t pp_read (struct file * file, char * buf, size_t count, ...@@ -118,6 +118,10 @@ static ssize_t pp_read (struct file * file, char * buf, size_t count,
return -EINVAL; return -EINVAL;
} }
/* Trivial case. */
if (count == 0)
return 0;
kbuffer = kmalloc(min_t(size_t, count, PP_BUFFER_SIZE), GFP_KERNEL); kbuffer = kmalloc(min_t(size_t, count, PP_BUFFER_SIZE), GFP_KERNEL);
if (!kbuffer) { if (!kbuffer) {
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment