From: Denis Vlasenko <vda.linux@googlemail.com>
To: Rik Faith <faith@valinux.com>,
Jeff Hartmann <jhartmann@valinux.com>,
Keith Whitwell <keith@tungstengraphics.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] i810_dma.c: fix pointer arithmetic for 64-bit target
Date: Sun, 13 Aug 2006 14:30:32 +0200 [thread overview]
Message-ID: <200608131430.32877.vda.linux@googlemail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 852 bytes --]
CC [M] drivers/char/drm/i810_dma.o
drivers/char/drm/i810_dma.c: In function 'i810_map_buffer':
drivers/char/drm/i810_dma.c:147: warning: cast from pointer to integer of different size
drivers/char/drm/i810_dma.c: In function 'i810_dma_dispatch_vertex':
drivers/char/drm/i810_dma.c:811: warning: cast from pointer to integer of different size
drivers/char/drm/i810_dma.c:811: warning: cast to pointer from integer of different size
drivers/char/drm/i810_dma.c: In function 'i810_dma_dispatch_mc':
drivers/char/drm/i810_dma.c:1169: warning: cast from pointer to integer of different size
drivers/char/drm/i810_dma.c:1169: warning: cast to pointer from integer of different size
First warning result from open-coded PTR_ERR,
the rest is caused by code like this:
*(u32 *) ((u32) buf_priv->kernel_virtual + used)
Patch fixes this. Please apply.
--
vda
[-- Attachment #2: i810_dma.c.diff --]
[-- Type: text/x-diff, Size: 1852 bytes --]
CC [M] drivers/char/drm/i810_dma.o
drivers/char/drm/i810_dma.c: In function 'i810_map_buffer':
drivers/char/drm/i810_dma.c:147: warning: cast from pointer to integer of different size
drivers/char/drm/i810_dma.c: In function 'i810_dma_dispatch_vertex':
drivers/char/drm/i810_dma.c:811: warning: cast from pointer to integer of different size
drivers/char/drm/i810_dma.c:811: warning: cast to pointer from integer of different size
drivers/char/drm/i810_dma.c: In function 'i810_dma_dispatch_mc':
drivers/char/drm/i810_dma.c:1169: warning: cast from pointer to integer of different size
drivers/char/drm/i810_dma.c:1169: warning: cast to pointer from integer of different size
--- linux-2.6.17.8.src/drivers/char/drm/i810_dma.c.org 2006-08-07 06:18:54.000000000 +0200
+++ linux-2.6.17.8.src/drivers/char/drm/i810_dma.c 2006-08-12 20:56:10.000000000 +0200
@@ -141,10 +141,10 @@ static int i810_map_buffer(drm_buf_t * b
MAP_SHARED, buf->bus_address);
dev_priv->mmap_buffer = NULL;
filp->f_op = old_fops;
- if ((unsigned long)buf_priv->virtual > -1024UL) {
+ if (IS_ERR(buf_priv->virtual)) {
/* Real error */
DRM_ERROR("mmap error\n");
- retcode = (signed int)buf_priv->virtual;
+ retcode = PTR_ERR(buf_priv->virtual);
buf_priv->virtual = NULL;
}
up_write(¤t->mm->mmap_sem);
@@ -808,7 +808,7 @@ static void i810_dma_dispatch_vertex(drm
((GFX_OP_PRIMITIVE | prim | ((used / 4) - 2)));
if (used & 4) {
- *(u32 *) ((u32) buf_priv->kernel_virtual + used) = 0;
+ *(u32 *) ((char *) buf_priv->kernel_virtual + used) = 0;
used += 4;
}
@@ -1166,7 +1166,7 @@ static void i810_dma_dispatch_mc(drm_dev
if (buf_priv->currently_mapped == I810_BUF_MAPPED) {
if (used & 4) {
- *(u32 *) ((u32) buf_priv->virtual + used) = 0;
+ *(u32 *) ((char *) buf_priv->virtual + used) = 0;
used += 4;
}
reply other threads:[~2006-08-13 12:30 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=200608131430.32877.vda.linux@googlemail.com \
--to=vda.linux@googlemail.com \
--cc=faith@valinux.com \
--cc=jhartmann@valinux.com \
--cc=keith@tungstengraphics.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox