All of lore.kernel.org
 help / color / mirror / Atom feed
From: bvanassche@acm.org (Bart Van Assche)
Subject: [PATCH v2 1/2] nvme-core: Make implicit seed truncation explicit
Date: Wed, 10 Oct 2018 08:08:19 -0700	[thread overview]
Message-ID: <20181010150820.203745-2-bvanassche@acm.org> (raw)
In-Reply-To: <20181010150820.203745-1-bvanassche@acm.org>

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 at acm.org>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 8cecb36b5af1..65c42448e904 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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)
-- 
2.19.0.605.g01d371f741-goog

  reply	other threads:[~2018-10-10 15:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 15:08 [PATCH v2 0/2] Fixes for issues detected by static analyzers Bart Van Assche
2018-10-10 15:08 ` Bart Van Assche [this message]
2018-10-10 15:34   ` [PATCH v2 1/2] nvme-core: Make implicit seed truncation explicit Keith Busch
2018-10-10 15:08 ` [PATCH v2 2/2] nvmet-fcloop: Suppress a compiler warning Bart Van Assche
2018-10-10 15:57   ` James Smart
2018-10-10 16:35     ` Bart Van Assche
2018-10-11  5:55 ` [PATCH v2 0/2] Fixes for issues detected by static analyzers Christoph Hellwig

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=20181010150820.203745-2-bvanassche@acm.org \
    --to=bvanassche@acm.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.