aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index c8a8af0fe471..a507d0b5be6c 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -356,19 +356,16 @@ static ssize_t flash_write(struct file *file, const char __user *buf,
356 356
357 pos = *ppos; 357 pos = *ppos;
358 358
359 if ( pos < 0) { 359 if (pos != 0) {
360 ret = -EINVAL; 360 ret = -EINVAL;
361 goto bail; 361 goto bail;
362 } 362 }
363 363
364 if (pos >= sizeof(struct ipath_flash)) { 364 if (count != sizeof(struct ipath_flash)) {
365 ret = 0; 365 ret = -EINVAL;
366 goto bail; 366 goto bail;
367 } 367 }
368 368
369 if (count > sizeof(struct ipath_flash) - pos)
370 count = sizeof(struct ipath_flash) - pos;
371
372 tmp = kmalloc(count, GFP_KERNEL); 369 tmp = kmalloc(count, GFP_KERNEL);
373 if (!tmp) { 370 if (!tmp) {
374 ret = -ENOMEM; 371 ret = -ENOMEM;