linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] compiler warning on 32-bit
@ 2008-09-19 14:53 Alan Jenkins
  2008-09-20  5:32 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Jenkins @ 2008-09-19 14:53 UTC (permalink / raw)
  To: linux-hotplug

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;



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH] compiler warning on 32-bit
  2008-09-19 14:53 [RFC PATCH] compiler warning on 32-bit Alan Jenkins
@ 2008-09-20  5:32 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2008-09-20  5:32 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Sep 19, 2008 at 07:53, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
> 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.

Applied.

Thanks,
Kay

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-20  5:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-19 14:53 [RFC PATCH] compiler warning on 32-bit Alan Jenkins
2008-09-20  5:32 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).