From: Hannes Reinecke <hare@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Hannes Reinecke <hare@suse.de>, Jiri Kosina <jkosina@suse.cz>
Subject: [PATCH] i2o: remove compile-time warnings
Date: Wed, 20 Feb 2013 14:24:50 +0100 [thread overview]
Message-ID: <1361366690-62274-1-git-send-email-hare@suse.de> (raw)
The compiler complains about invalid cast for i2o_config.
However, the ioctl passes us an 32-bit address, which we
have to assume is a valid 64-bit kernel address.
So we should cast this to 'unsigned long' before casting
it to a pointer.
Minimal fix, doesn't break anything which wasn't broken
before.
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
index 5451bef..5b95dc1 100644
--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -883,10 +883,9 @@ static int i2o_cfg_passthru(unsigned long arg)
/* Copy in the user's SG buffer if necessary */
if (sg[i].
flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR */ ) {
- // TODO 64bit fix
- if (copy_from_user
- (p->virt, (void __user *)sg[i].addr_bus,
- sg_size)) {
+ void __user *sg_addr = (void __user *)
+ (unsigned long)sg[i].addr_bus;
+ if (copy_from_user(p->virt, sg_addr, sg_size)) {
printk(KERN_DEBUG
"%s: Could not copy SG buf %d FROM user\n",
c->name, i);
@@ -937,11 +936,12 @@ static int i2o_cfg_passthru(unsigned long arg)
if (!
(sg[j].
flag_count & 0x4000000 /*I2O_SGL_FLAGS_DIR */ )) {
+ void __user *sg_addr = (void __user *)
+ (unsigned long)sg[j].addr_bus;
+
sg_size = sg[j].flag_count & 0xffffff;
- // TODO 64bit fix
- if (copy_to_user
- ((void __user *)sg[j].addr_bus, sg_list[j].virt,
- sg_size)) {
+ if (copy_to_user(sg_addr, sg_list[j].virt,
+ sg_size)) {
printk(KERN_WARNING
"%s: Could not copy %p TO user %x\n",
c->name, sg_list[j].virt,
next reply other threads:[~2013-02-20 13:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-20 13:24 Hannes Reinecke [this message]
2013-02-26 13:20 ` Jiri Kosina
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=1361366690-62274-1-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=jkosina@suse.cz \
--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
all inboxes | Powered by JetHome®