[PATCH] DRM: 64-bit warning in compilation: wrong param size in DRM or harmless?
From: Blaisorblade (blaisorblade_at_yahoo.it)
Date: 10/30/05
- Previous message: Mark Fasheh: "Re: [-mm patch] fs/ocfs2/: possible cleanups"
- Next in thread: Dave Airlie: "Re: [PATCH] DRM: 64-bit warning in compilation: wrong param size in DRM or harmless?"
- Reply: Dave Airlie: "Re: [PATCH] DRM: 64-bit warning in compilation: wrong param size in DRM or harmless?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: LKML <linux-kernel@vger.kernel.org> Date: Sun, 30 Oct 2005 13:53:02 +0100
I got a warning and while going to fix it, I discovered some issues with the
code (including raciness).
While compiling 2.6.14 for x86_64, I got:
CC [M] drivers/char/drm/drm_bufs.o
/home/paolo/Admin/kernel/6/VCS/linux-2.6.14/drivers/char/drm/drm_bufs.c: In
function `drm_addmap_ioctl':
/home/paolo/Admin/kernel/6/VCS/linux-2.6.14/drivers/char/drm/drm_bufs.c:309:
warning: cast to pointer from integer of different size
/home/paolo/Admin/kernel/6/VCS/linux-2.6.14/drivers/char/drm/drm_bufs.c:309:
warning: cast to pointer from integer of different size
/home/paolo/Admin/kernel/6/VCS/linux-2.6.14/drivers/char/drm/drm_bufs.c:309:
warning: cast to pointer from integer of different size
/home/paolo/Admin/kernel/6/VCS/linux-2.6.14/drivers/char/drm/drm_bufs.c:309:
warning: cast to pointer from integer of different size
All these warnings are generated by:
if (put_user(maplist->user_token, &argp->handle))
return -EFAULT;
Given the decls:
drm_map_list_t *maplist;
drm_map_t __user *argp = (void __user *)arg;
typedef struct drm_map {
...
void *handle;
/**< User-space: "Handle" to pass to mmap()*/
/**< Kernel-space: kernel-virtual address */
...
} drm_map_t;
maplist->user_token is an unsigned int, instead.
It seems that even if handle is overloaded, the two roles are totally
different and never interchanged, but I'm unsure.
In this case, the warning is totally harmless, so the attached patch avoids
the warning and fixes everything (compile-tested).
BUT:
* If we _ever_ have more drm_device_t, the call to HandleId() would be racy.
Right?
-- Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!". Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894) http://www.user-mode-linux.org/~blaisorblade
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- text/x-diff attachment: fix-drm-warn-x86-64
- Previous message: Mark Fasheh: "Re: [-mm patch] fs/ocfs2/: possible cleanups"
- Next in thread: Dave Airlie: "Re: [PATCH] DRM: 64-bit warning in compilation: wrong param size in DRM or harmless?"
- Reply: Dave Airlie: "Re: [PATCH] DRM: 64-bit warning in compilation: wrong param size in DRM or harmless?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|