X-Git-Url: https://code.grnet.gr/git/archipelago/blobdiff_plain/a5c1eefbe2b6b6501e998e8adf6e8c617c9d8387..f29c3bebd18166d63d26c8014e7f1ea2bfbbb8f0:/xseg/sys/kernel/segdev.c diff --git a/xseg/sys/kernel/segdev.c b/xseg/sys/kernel/segdev.c index 022372e..bb1a6ab 100644 --- a/xseg/sys/kernel/segdev.c +++ b/xseg/sys/kernel/segdev.c @@ -214,24 +214,21 @@ static ssize_t segdev_write(struct file *file, const char __user *buf, { struct segdev_file *vf = file->private_data; struct segdev *dev = segdev_get(vf->minor); - char buffer[SEGDEV_BUFSIZE]; uint32_t portno; int ret = -ENODEV; if (!dev) goto out; - if (count > SEGDEV_BUFSIZE) - count = SEGDEV_BUFSIZE; + if (count != sizeof(uint32_t)) + goto out; - ret = copy_from_user(buffer, buf, count); + ret = copy_from_user(&portno, buf, sizeof(uint32_t)); if (ret < 0) goto out; if((count - ret) != sizeof(uint32_t)) goto out; - portno = *(uint32_t *)buffer; - ret = 0; if (dev->callback) dev->callback(dev, portno);