diff options
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_diag.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c index af59bf380ca2..c9bfd827e71b 100644 --- a/drivers/infiniband/hw/ipath/ipath_diag.c +++ b/drivers/infiniband/hw/ipath/ipath_diag.c | |||
@@ -332,12 +332,17 @@ static ssize_t ipath_diagpkt_write(struct file *fp, | |||
332 | u64 val; | 332 | u64 val; |
333 | u32 l_state, lt_state; /* LinkState, LinkTrainingState */ | 333 | u32 l_state, lt_state; /* LinkState, LinkTrainingState */ |
334 | 334 | ||
335 | if (count != sizeof(dp)) { | 335 | if (count < sizeof(odp)) { |
336 | ret = -EINVAL; | 336 | ret = -EINVAL; |
337 | goto bail; | 337 | goto bail; |
338 | } | 338 | } |
339 | 339 | ||
340 | if (copy_from_user(&dp, data, sizeof(dp))) { | 340 | if (count == sizeof(dp)) { |
341 | if (copy_from_user(&dp, data, sizeof(dp))) { | ||
342 | ret = -EFAULT; | ||
343 | goto bail; | ||
344 | } | ||
345 | } else if (copy_from_user(&odp, data, sizeof(odp))) { | ||
341 | ret = -EFAULT; | 346 | ret = -EFAULT; |
342 | goto bail; | 347 | goto bail; |
343 | } | 348 | } |