]> err.no Git - linux-2.6/blobdiff - drivers/infiniband/hw/ipath/ipath_fs.c
IB/ipath: Only allow complete writes to flash
[linux-2.6] / drivers / infiniband / hw / ipath / ipath_fs.c
index c8a8af0fe47175abfe6c2f07aa36df9d0a07d2a5..a507d0b5be6c9c8bf31e2b4a3b22ed27a1e705c1 100644 (file)
@@ -356,19 +356,16 @@ static ssize_t flash_write(struct file *file, const char __user *buf,
 
        pos = *ppos;
 
-       if ( pos < 0) {
+       if (pos != 0) {
                ret = -EINVAL;
                goto bail;
        }
 
-       if (pos >= sizeof(struct ipath_flash)) {
-               ret = 0;
+       if (count != sizeof(struct ipath_flash)) {
+               ret = -EINVAL;
                goto bail;
        }
 
-       if (count > sizeof(struct ipath_flash) - pos)
-               count = sizeof(struct ipath_flash) - pos;
-
        tmp = kmalloc(count, GFP_KERNEL);
        if (!tmp) {
                ret = -ENOMEM;