All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDSRDMA: Fix to PAGE_MASK interpretation
@ 2011-08-29 19:28 Jonathan Lallinger
  2011-08-31 15:57 ` Steve Wise
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Lallinger @ 2011-08-29 19:28 UTC (permalink / raw)
  To: venkat.x.venkatsubra; +Cc: swise, netdev, rds-devel

The RDS_RDMA rds_iw_map_scatterlist function assumed PAGE_MASK was the bitwise
compliment of what it actually is. This problem was introduced in commit
404bb72a56e553febe1055f98347a7a3e3145759 when the variable dma_mask was replaced
by PAGE_MASK, however dma_mask represented the compliment of what PAGE_MASK
represents.

This fix corrects the logic by flipping the compliments on all uses of PAGE_MASK
int rds_iw_map_scatterlist.

Signed-off by: Jonathan Lallinger <jonathan@ogc.us>
---

 net/rds/iw_rdma.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/rds/iw_rdma.c b/net/rds/iw_rdma.c
index 6deaa77..92f4efc 100644
--- a/net/rds/iw_rdma.c
+++ b/net/rds/iw_rdma.c
@@ -287,15 +287,15 @@ static u64 *rds_iw_map_scatterlist(struct rds_iw_device *rds_iwdev,
 		sg->bytes += dma_len;
 
 		end_addr = dma_addr + dma_len;
-		if (dma_addr & PAGE_MASK) {
+		if (dma_addr & ~PAGE_MASK) {
 			if (i > 0)
 				goto out_unmap;
-			dma_addr &= ~PAGE_MASK;
+			dma_addr &= PAGE_MASK;
 		}
-		if (end_addr & PAGE_MASK) {
+		if (end_addr & ~PAGE_MASK) {
 			if (i < sg->dma_len - 1)
 				goto out_unmap;
-			end_addr = (end_addr + PAGE_MASK) & ~PAGE_MASK;
+			end_addr = (end_addr + ~PAGE_MASK) & PAGE_MASK;
 		}
 
 		sg->dma_npages += (end_addr - dma_addr) >> PAGE_SHIFT;
@@ -317,7 +317,7 @@ static u64 *rds_iw_map_scatterlist(struct rds_iw_device *rds_iwdev,
 		u64 end_addr;
 
 		end_addr = dma_addr + dma_len;
-		dma_addr &= ~PAGE_MASK;
+		dma_addr &= PAGE_MASK;
 		for (; dma_addr < end_addr; dma_addr += PAGE_SIZE)
 			dma_pages[j++] = dma_addr;
 		BUG_ON(j > sg->dma_npages);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDSRDMA: Fix to PAGE_MASK interpretation
  2011-08-29 19:28 [PATCH] RDSRDMA: Fix to PAGE_MASK interpretation Jonathan Lallinger
@ 2011-08-31 15:57 ` Steve Wise
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Wise @ 2011-08-31 15:57 UTC (permalink / raw)
  To: venkat.x.venkatsubra; +Cc: Jonathan Lallinger, netdev, rds-devel

Reviewed-by:  Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] RDSRDMA: Fix to PAGE_MASK interpretation
@ 2011-09-09 14:35 Venkat Venkatsubra
  0 siblings, 0 replies; 3+ messages in thread
From: Venkat Venkatsubra @ 2011-09-09 14:35 UTC (permalink / raw)
  To: Netdev, Rds-Devel; +Cc: Davem


On 08/29/2011 02:28 PM, Jonathan Lallinger wrote:
> The RDS_RDMA rds_iw_map_scatterlist function assumed PAGE_MASK was the bitwise
> compliment of what it actually is. This problem was introduced in commit
> 404bb72a56e553febe1055f98347a7a3e3145759 when the variable dma_mask was replaced
> by PAGE_MASK, however dma_mask represented the compliment of what PAGE_MASK
> represents.
>
> This fix corrects the logic by flipping the compliments on all uses of PAGE_MASK
> int rds_iw_map_scatterlist.
>
> Signed-off by: Jonathan Lallinger<jonathan@ogc.us>

Signed-off-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>

Venkat

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-09 14:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-29 19:28 [PATCH] RDSRDMA: Fix to PAGE_MASK interpretation Jonathan Lallinger
2011-08-31 15:57 ` Steve Wise
2011-09-09 14:35 Venkat Venkatsubra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.