summaryrefslogtreecommitdiff
path: root/drivers/staging/rdma/hfi1
diff options
context:
space:
mode:
authorMitko Haralanov <mitko.haralanov@intel.com>2015-10-26 14:28:39 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-27 08:20:41 (GMT)
commit3c6c065a510ed59f7fddabac4be2f932ecfe9275 (patch)
tree2ce906208eea79617eda4f4fc16d233c4704bf8b /drivers/staging/rdma/hfi1
parentb9fb6318d0696b481b1e3cd8aa702141a59569c0 (diff)
downloadlinux-3c6c065a510ed59f7fddabac4be2f932ecfe9275.tar.xz
staging/rdma/hfi1: Wrong cast breaks desired pointer arithmetic
The address being mapped into a process's memory for notification events was improperly calculated due to cast that was happening too early. dd->events is a pointer and should have been casted to unsigned long after the pointer arithmetic was done, not before. As a result, processes were looking at the wrong place and not seeing their notification events. Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com> Signed-off-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rdma/hfi1')
-rw-r--r--drivers/staging/rdma/hfi1/file_ops.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c
index 955f80d..aae9826 100644
--- a/drivers/staging/rdma/hfi1/file_ops.c
+++ b/drivers/staging/rdma/hfi1/file_ops.c
@@ -607,9 +607,9 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma)
* Use the page where this context's flags are. User level
* knows where it's own bitmap is within the page.
*/
- memaddr = ((unsigned long)dd->events +
- ((uctxt->ctxt - dd->first_user_ctxt) *
- HFI1_MAX_SHARED_CTXTS)) & PAGE_MASK;
+ memaddr = (unsigned long)(dd->events +
+ ((uctxt->ctxt - dd->first_user_ctxt) *
+ HFI1_MAX_SHARED_CTXTS)) & PAGE_MASK;
memlen = PAGE_SIZE;
/*
* v3.7 removes VM_RESERVED but the effect is kept by