All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Tettamanti <kronos.it@gmail.com>
To: linux-media@vger.kernel.org
Cc: Manu Abraham <manu@linuxtv.org>
Subject: [PATCH] saa716x: fix pointer cast to 32bit
Date: Sun, 18 Jan 2009 19:21:26 +0100	[thread overview]
Message-ID: <20090118182126.GA18750@dreamland.darkstar.lan> (raw)

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.

Signed-off-by: Luca Tettamanti <kronos.it@gmail.com>
---
 linux/drivers/media/dvb/saa716x/saa716x_dma.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: b/linux/drivers/media/dvb/saa716x/saa716x_dma.c
===================================================================
--- a/linux/drivers/media/dvb/saa716x/saa716x_dma.c	2009-01-18 19:13:35.126021813 +0100
+++ b/linux/drivers/media/dvb/saa716x/saa716x_dma.c	2009-01-18 19:15:34.074015003 +0100
@@ -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
-- 
"La vita potrebbe non avere alcun significato. Oppure, ancora peggio,
 potrebbe averne uno che disapprovo". -- Ashleigh Brilliant

                 reply	other threads:[~2009-01-18 18:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090118182126.GA18750@dreamland.darkstar.lan \
    --to=kronos.it@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=manu@linuxtv.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.