Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c6c065a authored by Mitko Haralanov's avatar Mitko Haralanov Committed by Greg Kroah-Hartman
Browse files

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: default avatarMitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b9fb6318
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -607,7 +607,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma)
		 * Use the page where this context's flags are. User level
		 * Use the page where this context's flags are. User level
		 * knows where it's own bitmap is within the page.
		 * knows where it's own bitmap is within the page.
		 */
		 */
		memaddr = ((unsigned long)dd->events +
		memaddr = (unsigned long)(dd->events +
					  ((uctxt->ctxt - dd->first_user_ctxt) *
					  ((uctxt->ctxt - dd->first_user_ctxt) *
					   HFI1_MAX_SHARED_CTXTS)) & PAGE_MASK;
					   HFI1_MAX_SHARED_CTXTS)) & PAGE_MASK;
		memlen = PAGE_SIZE;
		memlen = PAGE_SIZE;