aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_fs.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index c8a8af0fe471..d9ff283f725e 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -66,8 +66,8 @@ static int ipathfs_mknod(struct inode *dir, struct dentry *dentry,
66 inode->i_private = data; 66 inode->i_private = data;
67 if ((mode & S_IFMT) == S_IFDIR) { 67 if ((mode & S_IFMT) == S_IFDIR) {
68 inode->i_op = &simple_dir_inode_operations; 68 inode->i_op = &simple_dir_inode_operations;
69 inode->i_nlink++; 69 inc_nlink(inode);
70 dir->i_nlink++; 70 inc_nlink(dir);
71 } 71 }
72 72
73 inode->i_fop = fops; 73 inode->i_fop = fops;
@@ -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;