Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH] nvme: use upper_32_bits() instead of bit shift
Date: Wed, 28 Mar 2018 08:20:14 -0600	[thread overview]
Message-ID: <20180328142014.GB13039@localhost.localdomain> (raw)
In-Reply-To: <20180328135817.2419127-1-arnd@arndb.de>

On Wed, Mar 28, 2018@03:57:47PM +0200, Arnd Bergmann wrote:
> @@ -2233,8 +2233,8 @@ int nvme_get_log_ext(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
>  	c.get_log_page.lid = log_page;
>  	c.get_log_page.numdl = cpu_to_le16(dwlen & ((1 << 16) - 1));
>  	c.get_log_page.numdu = cpu_to_le16(dwlen >> 16);
> -	c.get_log_page.lpol = cpu_to_le32(offset & ((1ULL << 32) - 1));
> -	c.get_log_page.lpou = cpu_to_le32(offset >> 32ULL);
> +	c.get_log_page.lpol = cpu_to_le32(lower_32_bits(offset));
> +	c.get_log_page.lpou = cpu_to_le32(upper_32_bits(offset));
>  
>  	return nvme_submit_sync_cmd(ctrl->admin_q, &c, log, size);
>  }

Right, Matias posted the same fix here:

 http://lists.infradead.org/pipermail/linux-nvme/2018-March/016474.html

In addition to the type safe shifting, a 64-bit type was used to match
the spec.

      parent reply	other threads:[~2018-03-28 14:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 13:57 [PATCH] nvme: use upper_32_bits() instead of bit shift Arnd Bergmann
2018-03-28 14:05 ` Johannes Thumshirn
2018-03-28 14:20 ` Keith Busch [this message]

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=20180328142014.GB13039@localhost.localdomain \
    --to=keith.busch@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox