aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2015-10-06 16:29:48 -0400
committerJens Axboe <axboe@fb.com>2015-10-12 15:09:15 -0400
commit3d42e67fe5ebc1e5c3aae9b1037e38ec99a362cc (patch)
tree31704407f5903f25bd5dcc5c24a3f30fd45c8bb2
parent11feb18f4edb1423ed6091908c45de7ade30d5b7 (diff)
nvme: fix 32-bit build warning
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 'uintptr_t'. I had previously submitted a patch to fix this problem in the nvme driver, but it was accepted on the same day that two new warnings got added. For clarification, I also change the third instance of this cast to use uintptr_t instead of unsigned long now. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: d29ec8241c10e ("nvme: submit internal commands through the block layer") Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--drivers/nvme/host/pci.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index a526696d684d..ad58ee3c3b57 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1802,7 +1802,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
1802 1802
1803 length = (io.nblocks + 1) << ns->lba_shift; 1803 length = (io.nblocks + 1) << ns->lba_shift;
1804 meta_len = (io.nblocks + 1) * ns->ms; 1804 meta_len = (io.nblocks + 1) * ns->ms;
1805 metadata = (void __user *)(unsigned long)io.metadata; 1805 metadata = (void __user *)(uintptr_t)io.metadata;
1806 write = io.opcode & 1; 1806 write = io.opcode & 1;
1807 1807
1808 if (ns->ext) { 1808 if (ns->ext) {
@@ -1842,7 +1842,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
1842 c.rw.metadata = cpu_to_le64(meta_dma); 1842 c.rw.metadata = cpu_to_le64(meta_dma);
1843 1843
1844 status = __nvme_submit_sync_cmd(ns->queue, &c, NULL, 1844 status = __nvme_submit_sync_cmd(ns->queue, &c, NULL,
1845 (void __user *)io.addr, length, NULL, 0); 1845 (void __user *)(uintptr_t)io.addr, length, NULL, 0);
1846 unmap: 1846 unmap:
1847 if (meta) { 1847 if (meta) {
1848 if (status == NVME_SC_SUCCESS && !write) { 1848 if (status == NVME_SC_SUCCESS && !write) {
@@ -1884,7 +1884,7 @@ static int nvme_user_cmd(struct nvme_dev *dev, struct nvme_ns *ns,
1884 timeout = msecs_to_jiffies(cmd.timeout_ms); 1884 timeout = msecs_to_jiffies(cmd.timeout_ms);
1885 1885
1886 status = __nvme_submit_sync_cmd(ns ? ns->queue : dev->admin_q, &c, 1886 status = __nvme_submit_sync_cmd(ns ? ns->queue : dev->admin_q, &c,
1887 NULL, (void __user *)cmd.addr, cmd.data_len, 1887 NULL, (void __user *)(uintptr_t)cmd.addr, cmd.data_len,
1888 &cmd.result, timeout); 1888 &cmd.result, timeout);
1889 if (status >= 0) { 1889 if (status >= 0) {
1890 if (put_user(cmd.result, &ucmd->result)) 1890 if (put_user(cmd.result, &ucmd->result))