All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: linux-hotplug@vger.kernel.org
Subject: [RFC PATCH] compiler warning on 32-bit
Date: Fri, 19 Sep 2008 14:53:25 +0000	[thread overview]
Message-ID: <48D3BCE5.50703@tuffmail.co.uk> (raw)

The sg_io_v4 interface passes pointers as u64s.  It turns out GCC
disapproves of us casting a u64 straight to a 32 bit pointer.

cc1: warnings being treated as errors
scsi_serial.c: In function ‘sg_err_category4’:
scsi_serial.c:159: warning: cast to pointer from integer of different size
scsi_serial.c: In function ‘scsi_dump_v4’:
scsi_serial.c:303: warning: cast to pointer from integer of different size

We could either suppress this with -Wno-int-to-pointer-cast or work around it.

diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c
index 757f41d..20d30cf 100644
--- a/extras/scsi_id/scsi_serial.c
+++ b/extras/scsi_id/scsi_serial.c
@@ -156,7 +156,7 @@ static int sg_err_category4(struct udev *udev, struct sg_io_v4 *hp)
 {
 	return sg_err_category_new(udev, hp->device_status, 0,
 				   hp->transport_status, hp->driver_status,
-				   (unsigned char *)hp->response,
+				   (unsigned char *)(uintptr_t)hp->response,
 				   hp->response_len);
 }
 
@@ -300,7 +300,7 @@ static int scsi_dump_v4(struct udev *udev,
 	    dev_scsi->kernel, io->driver_status, io->transport_status,
 	     io->device_status);
 	if (io->device_status = SCSI_CHECK_CONDITION)
-		return scsi_dump_sense(udev, dev_scsi, (unsigned char *)io->response,
+		return scsi_dump_sense(udev, dev_scsi, (unsigned char *)(uintptr_t)io->response,
 				       io->response_len);
 	else
 		return -1;



             reply	other threads:[~2008-09-19 14:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19 14:53 Alan Jenkins [this message]
2008-09-20  5:32 ` [RFC PATCH] compiler warning on 32-bit Kay Sievers

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=48D3BCE5.50703@tuffmail.co.uk \
    --to=alan-jenkins@tuffmail.co.uk \
    --cc=linux-hotplug@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 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.