lkml.org 
[lkml]   [2018]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] nvme: use upper_32_bits() instead of bit shift
On Wed, Mar 28, 2018 at 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.

\
 
 \ /
  Last update: 2018-03-28 16:18    [W:0.028 / U:0.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site