Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 26016
b: refs/heads/master
c: 6a2a886
h: refs/heads/master
v: v3
  • Loading branch information
Antonino A. Daplas authored and Linus Torvalds committed Apr 19, 2006
1 parent 8fa7350 commit 960feb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a61bdaad6c696e850d8fa412f1f201cbca51ad30
refs/heads/master: 6a2a88668e90cd2459d0493e3e3ff17c3557febc
14 changes: 10 additions & 4 deletions trunk/drivers/video/fbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,13 +674,19 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
total_size = info->fix.smem_len;

if (p > total_size)
return 0;
return -EFBIG;

if (count >= total_size)
if (count > total_size) {
err = -EFBIG;
count = total_size;
}

if (count + p > total_size) {
if (!err)
err = -ENOSPC;

if (count + p > total_size)
count = total_size - p;
}

buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count,
GFP_KERNEL);
Expand Down Expand Up @@ -722,7 +728,7 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)

kfree(buffer);

return (err) ? err : cnt;
return (cnt) ? cnt : err;
}

#ifdef CONFIG_KMOD
Expand Down

0 comments on commit 960feb3

Please sign in to comment.