diff options
author | Arnd Bergmann <arnd@arndb.de> | 2015-05-19 11:05:40 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-05-29 12:06:21 -0400 |
commit | fec558b5f178d9eb35d2ed76f15489c60e3590bd (patch) | |
tree | 6cc32d362f0b820f8f2828f32b6b544e9a42ad7a | |
parent | aad653a0bc09dd4ebcb5579f9f835bbae9ef2ba3 (diff) |
NVMe: fix type warning on 32-bit
A recent change to the ioctl handling caused a new harmless
warning in the NVMe driver on all 32-bit machines:
drivers/block/nvme-core.c: In function 'nvme_submit_io':
drivers/block/nvme-core.c:1794:29: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
In order to shup up that warning, this introduces a new
temporary variable that uses a double cast to extract
the pointer from an __u64 structure member.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: a67a95134ff ("NVMe: Meta data handling through submit io ioctl")
Acked-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | drivers/block/nvme-core.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 85b8036deaa3..683dff272562 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -1750,6 +1750,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) | |||
1750 | struct nvme_iod *iod; | 1750 | struct nvme_iod *iod; |
1751 | dma_addr_t meta_dma = 0; | 1751 | dma_addr_t meta_dma = 0; |
1752 | void *meta = NULL; | 1752 | void *meta = NULL; |
1753 | void __user *metadata; | ||
1753 | 1754 | ||
1754 | if (copy_from_user(&io, uio, sizeof(io))) | 1755 | if (copy_from_user(&io, uio, sizeof(io))) |
1755 | return -EFAULT; | 1756 | return -EFAULT; |
@@ -1763,6 +1764,8 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) | |||
1763 | meta_len = 0; | 1764 | meta_len = 0; |
1764 | } | 1765 | } |
1765 | 1766 | ||
1767 | metadata = (void __user *)(unsigned long)io.metadata; | ||
1768 | |||
1766 | write = io.opcode & 1; | 1769 | write = io.opcode & 1; |
1767 | 1770 | ||
1768 | switch (io.opcode) { | 1771 | switch (io.opcode) { |
@@ -1786,13 +1789,13 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) | |||
1786 | if (meta_len) { | 1789 | if (meta_len) { |
1787 | meta = dma_alloc_coherent(&dev->pci_dev->dev, meta_len, | 1790 | meta = dma_alloc_coherent(&dev->pci_dev->dev, meta_len, |
1788 | &meta_dma, GFP_KERNEL); | 1791 | &meta_dma, GFP_KERNEL); |
1792 | |||
1789 | if (!meta) { | 1793 | if (!meta) { |
1790 | status = -ENOMEM; | 1794 | status = -ENOMEM; |
1791 | goto unmap; | 1795 | goto unmap; |
1792 | } | 1796 | } |
1793 | if (write) { | 1797 | if (write) { |
1794 | if (copy_from_user(meta, (void __user *)io.metadata, | 1798 | if (copy_from_user(meta, metadata, meta_len)) { |
1795 | meta_len)) { | ||
1796 | status = -EFAULT; | 1799 | status = -EFAULT; |
1797 | goto unmap; | 1800 | goto unmap; |
1798 | } | 1801 | } |
@@ -1819,8 +1822,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) | |||
1819 | nvme_free_iod(dev, iod); | 1822 | nvme_free_iod(dev, iod); |
1820 | if (meta) { | 1823 | if (meta) { |
1821 | if (status == NVME_SC_SUCCESS && !write) { | 1824 | if (status == NVME_SC_SUCCESS && !write) { |
1822 | if (copy_to_user((void __user *)io.metadata, meta, | 1825 | if (copy_to_user(metadata, meta, meta_len)) |
1823 | meta_len)) | ||
1824 | status = -EFAULT; | 1826 | status = -EFAULT; |
1825 | } | 1827 | } |
1826 | dma_free_coherent(&dev->pci_dev->dev, meta_len, meta, meta_dma); | 1828 | dma_free_coherent(&dev->pci_dev->dev, meta_len, meta, meta_dma); |