]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
nvme-core: make implicit seed truncation explicit
authorBart Van Assche <bvanassche@acm.org>
Wed, 10 Oct 2018 15:08:19 +0000 (08:08 -0700)
committerChristoph Hellwig <hch@lst.de>
Wed, 17 Oct 2018 06:58:30 +0000 (08:58 +0200)
The nvme_user_io.slba field is 64 bits wide. That value is copied into the
32-bit bio_integrity_payload.bip_iter.bi_sector field. Make that truncation
explicit to avoid that Coverity complains about implicit truncation. See
also Coverity ID 1056486 on http://scan.coverity.com/projects/linux.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c

index 8cecb36b5af1f802120e689ff2af7e6fed11a904..65c42448e904ce5ab11f3871ad4c8807f1c3def1 100644 (file)
@@ -1132,7 +1132,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
 
        return nvme_submit_user_cmd(ns->queue, &c,
                        (void __user *)(uintptr_t)io.addr, length,
-                       metadata, meta_len, io.slba, NULL, 0);
+                       metadata, meta_len, lower_32_bits(io.slba), NULL, 0);
 }
 
 static u32 nvme_known_admin_effects(u8 opcode)