lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250317170938569jgM2gAWy39rgQQbnOh0Vu@zte.com.cn>
Date: Mon, 17 Mar 2025 17:09:38 +0800 (CST)
From: <shao.mingyin@....com.cn>
To: <hch@....de>
Cc: <sagi@...mberg.me>, <kch@...dia.com>, <linux-nvme@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <yang.tao172@....com.cn>,
        <yang.yang29@....com.cn>, <xu.xin16@....com.cn>
Subject: Re: [PATCH] nvme: replace max(a, min(b, c)) by clamp(b, a, c)

Dear best,
Please ignore this patch. We will submit a v2 patch instead.
>From: LiHaoran <li.haoran7@....com.cn>
>
>This patch replaces max(a, min(b, c)) by clamp(b, a, c) in the nvme
>driver. This improves the readability.
>
>Signed-off-by: LiHaoran <li.haoran7@....com.cn>
>Cc: ShaoMingyin <shao.mingyin@....com.cn>
>---
> drivers/nvme/target/nvmet.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
>index fcf4f460dc9a..30804b0ca66e 100644
>--- a/drivers/nvme/target/nvmet.h
>+++ b/drivers/nvme/target/nvmet.h
>@@ -819,7 +819,7 @@ static inline u8 nvmet_cc_iocqes(u32 cc)
> /* Convert a 32-bit number to a 16-bit 0's based number */
> static inline __le16 to0based(u32 a)
> {
>- return cpu_to_le16(max(1U, min(1U << 16, a)) - 1);
>+ return cpu_to_le16(clamp(1U << 16, 1U, a) - 1);
> }
>
> static inline bool nvmet_ns_has_pi(struct nvmet_ns *ns)
>--
>2.25.1
<div class="zcontentRow"><p>Dear best,</p><p>Please ignore this patch. We will submit a v2 patch instead.</p><p>&gt;From: LiHaoran &lt;li.haoran7@....com.cn&gt;</p><p>&gt;</p><p>&gt;This patch replaces max(a, min(b, c)) by clamp(b, a, c) in the nvme</p><p>&gt;driver. This improves the readability.</p><p>&gt;</p><p>&gt;Signed-off-by: LiHaoran &lt;li.haoran7@....com.cn&gt;</p><p>&gt;Cc: ShaoMingyin &lt;shao.mingyin@....com.cn&gt;</p><p>&gt;---</p><p>&gt; drivers/nvme/target/nvmet.h | 2 +-</p><p>&gt; 1 file changed, 1 insertion(+), 1 deletion(-)</p><p>&gt;</p><p>&gt;diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h</p><p>&gt;index fcf4f460dc9a..30804b0ca66e 100644</p><p>&gt;--- a/drivers/nvme/target/nvmet.h</p><p>&gt;+++ b/drivers/nvme/target/nvmet.h</p><p>&gt;@@ -819,7 +819,7 @@ static inline u8 nvmet_cc_iocqes(u32 cc)</p><p>&gt; /* Convert a 32-bit number to a 16-bit 0's based number */</p><p>&gt; static inline __le16 to0based(u32 a)</p><p>&gt; {</p><p>&gt;- return cpu_to_le16(max(1U, min(1U &lt;&lt; 16, a)) - 1);</p><p>&gt;+ return cpu_to_le16(clamp(1U &lt;&lt; 16, 1U, a) - 1);</p><p>&gt; }</p><p>&gt;</p><p>&gt; static inline bool nvmet_ns_has_pi(struct nvmet_ns *ns)</p><p>&gt;--</p><p>&gt;2.25.1</p><p style="font-size:14px;font-family:微软雅黑,Microsoft YaHei;"><br></p></div>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ