Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 94195
b: refs/heads/master
c: 963654a
h: refs/heads/master
i:
  94193: 7ab68a2
  94191: e096daf
v: v3
  • Loading branch information
Jaya Kumar authored and Linus Torvalds committed Apr 28, 2008
1 parent 520b3ff commit 525c4a7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 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: 555514fabc1c24fac69ff46feac384180828182c
refs/heads/master: 963654a9c919d18f8b9137f8ffd9d2d30a139269
52 changes: 27 additions & 25 deletions trunk/drivers/video/hecubafb.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,41 +270,43 @@ static void hecubafb_imageblit(struct fb_info *info,
static ssize_t hecubafb_write(struct fb_info *info, const char __user *buf,
size_t count, loff_t *ppos)
{
unsigned long p;
int err=-EINVAL;
struct hecubafb_par *par;
unsigned int xres;
unsigned int fbmemlength;
struct hecubafb_par *par = info->par;
unsigned long p = *ppos;
void *dst;
int err = 0;
unsigned long total_size;

p = *ppos;
par = info->par;
xres = info->var.xres;
fbmemlength = (xres * info->var.yres)/8;
if (info->state != FBINFO_STATE_RUNNING)
return -EPERM;

if (p > fbmemlength)
return -ENOSPC;
total_size = info->fix.smem_len;

err = 0;
if ((count + p) > fbmemlength) {
count = fbmemlength - p;
err = -ENOSPC;
if (p > total_size)
return -EFBIG;

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

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

base_addr = (char __force *)info->screen_base;
count -= copy_from_user(base_addr + p, buf, count);
*ppos += count;
err = -EFAULT;
count = total_size - p;
}

hecubafb_dpy_update(par);
dst = (void __force *) (info->screen_base + p);

if (copy_from_user(dst, buf, count))
err = -EFAULT;

if (count)
return count;
if (!err)
*ppos += count;

hecubafb_dpy_update(par);

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

static struct fb_ops hecubafb_ops = {
Expand Down

0 comments on commit 525c4a7

Please sign in to comment.