Skip to contentSkip to conversation

saa716x: fix pointer cast to 32bit

PATCH New Luca Tettamanti 1 participant 1 message Jan 18, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 saa716x: fix pointer cast to 32bit

Pointers may be 64bit long, casting them to u32 is wrong.
For doing math on the address unsigned long is guaranteed to have to correct size to hold the value of the pointer.

---
 linux/drivers/media/dvb/saa716x/saa716x_dma.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
linux/drivers/media/dvb/saa716x/saa716x_dma.c +3 -3
Index: b/linux/drivers/media/dvb/saa716x/saa716x_dma.c
===================================================================
@@ -34,7 +34,7 @@
 		return -ENOMEM;
 	}
 
-	BUG_ON(!(((u32) dmabuf->mem_ptab_phys % SAA716x_PAGE_SIZE) == 0));
+	BUG_ON(!(((unsigned long) dmabuf->mem_ptab_phys % SAA716x_PAGE_SIZE) == 0));
 
 	return 0;
 }
@@ -126,9 +126,9 @@
 		}
 
 		/* align memory to page */
-		dmabuf->mem_virt = (void *) PAGE_ALIGN (((u32) dmabuf->mem_virt_noalign));
+		dmabuf->mem_virt = (void *) PAGE_ALIGN (((unsigned long) dmabuf->mem_virt_noalign));
 
-		BUG_ON(!((((u32) dmabuf->mem_virt) % SAA716x_PAGE_SIZE) == 0));
+		BUG_ON(!((((unsigned long) dmabuf->mem_virt) % SAA716x_PAGE_SIZE) == 0));
 	} else {
 		dmabuf->mem_virt = buf;
 	}

Luca

Signature · 2 lines
"La vita potrebbe non avere alcun significato. Oppure, ancora peggio,
 potrebbe averne uno che disapprovo". -- Ashleigh Brilliant