All of lore.kernel.org
 help / color / mirror / Atom feed
From: hch@infradead.org (Christoph Hellwig)
Subject: [PATCH] nvme: fix 32-bit build warning
Date: Fri, 9 Oct 2015 07:42:21 -0700	[thread overview]
Message-ID: <20151009144221.GA12760@infradead.org> (raw)
In-Reply-To: <5851501.PBMrs03XFb@wuerfel>

On Tue, Oct 06, 2015@10:37:11PM +0200, Arnd Bergmann wrote:
> Compiling the nvme driver on 32-bit warns about a cast from a __u64
> variable to a pointer:
> 
> drivers/block/nvme-core.c: In function 'nvme_submit_io':
> drivers/block/nvme-core.c:1847:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>     (void __user *)io.addr, length, NULL, 0);
> 
> The cast here is intentional and safe, so we can shut up the
> gcc warning by adding an intermediate cast to 'unsigned long'.

It really should be a uintptr_t, which would also avoid the > 80
character lines.  I wonder if we need a u64_to_ptr helper given these
ioctl ABIs that pass pointers as a u64 seems to be everywhere these
days.

WARNING: multiple messages have this Message-ID (diff)
From: hch@infradead.org (Christoph Hellwig)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] nvme: fix 32-bit build warning
Date: Fri, 9 Oct 2015 07:42:21 -0700	[thread overview]
Message-ID: <20151009144221.GA12760@infradead.org> (raw)
In-Reply-To: <5851501.PBMrs03XFb@wuerfel>

On Tue, Oct 06, 2015 at 10:37:11PM +0200, Arnd Bergmann wrote:
> Compiling the nvme driver on 32-bit warns about a cast from a __u64
> variable to a pointer:
> 
> drivers/block/nvme-core.c: In function 'nvme_submit_io':
> drivers/block/nvme-core.c:1847:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>     (void __user *)io.addr, length, NULL, 0);
> 
> The cast here is intentional and safe, so we can shut up the
> gcc warning by adding an intermediate cast to 'unsigned long'.

It really should be a uintptr_t, which would also avoid the > 80
character lines.  I wonder if we need a u64_to_ptr helper given these
ioctl ABIs that pass pointers as a u64 seems to be everywhere these
days.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@infradead.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Matthew Wilcox <willy@linux.intel.com>, Jens Axboe <axboe@fb.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] nvme: fix 32-bit build warning
Date: Fri, 9 Oct 2015 07:42:21 -0700	[thread overview]
Message-ID: <20151009144221.GA12760@infradead.org> (raw)
In-Reply-To: <5851501.PBMrs03XFb@wuerfel>

On Tue, Oct 06, 2015 at 10:37:11PM +0200, Arnd Bergmann wrote:
> Compiling the nvme driver on 32-bit warns about a cast from a __u64
> variable to a pointer:
> 
> drivers/block/nvme-core.c: In function 'nvme_submit_io':
> drivers/block/nvme-core.c:1847:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>     (void __user *)io.addr, length, NULL, 0);
> 
> The cast here is intentional and safe, so we can shut up the
> gcc warning by adding an intermediate cast to 'unsigned long'.

It really should be a uintptr_t, which would also avoid the > 80
character lines.  I wonder if we need a u64_to_ptr helper given these
ioctl ABIs that pass pointers as a u64 seems to be everywhere these
days.

  reply	other threads:[~2015-10-09 14:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 20:37 [PATCH] nvme: fix 32-bit build warning Arnd Bergmann
2015-10-06 20:37 ` Arnd Bergmann
2015-10-06 20:37 ` Arnd Bergmann
2015-10-09 14:42 ` Christoph Hellwig [this message]
2015-10-09 14:42   ` Christoph Hellwig
2015-10-09 14:42   ` Christoph Hellwig
2015-10-09 18:55   ` Arnd Bergmann
2015-10-09 18:55     ` Arnd Bergmann
2015-10-09 18:55     ` Arnd Bergmann
2015-10-09 18:58   ` [PATCH v2] " Arnd Bergmann
2015-10-09 18:58     ` Arnd Bergmann
2015-10-09 18:58     ` Arnd Bergmann
2015-10-12 19:03     ` Christoph Hellwig
2015-10-12 19:03       ` Christoph Hellwig
2015-10-12 19:03       ` Christoph Hellwig
2015-10-12 19:10       ` Jens Axboe
2015-10-12 19:10         ` Jens Axboe
2015-10-12 19:10         ` Jens Axboe
2015-10-12 19:14         ` Arnd Bergmann
2015-10-12 19:14           ` Arnd Bergmann
2015-10-12 19:14           ` Arnd Bergmann
2015-10-12 19:22           ` Jens Axboe
2015-10-12 19:22             ` Jens Axboe
2015-10-12 19:22             ` Jens Axboe

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=20151009144221.GA12760@infradead.org \
    --to=hch@infradead.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.