[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9291974f2d914f68b037d79f7fe505e2@meizu.com>
Date: Wed, 16 Mar 2022 01:48:18 +0000
From: 白浩文 <baihaowen@...zu.com>
To: David Laight <David.Laight@...LAB.COM>,
"freude@...ux.ibm.com" <freude@...ux.ibm.com>,
"hca@...ux.ibm.com" <hca@...ux.ibm.com>,
"gor@...ux.ibm.com" <gor@...ux.ibm.com>,
"agordeev@...ux.ibm.com" <agordeev@...ux.ibm.com>
CC: "linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: 答复: [PATCH v2] s390: crypto: Use min() instead of doing it manually
hi, David
Thank you for your reply, all is ok, just a coding style.
Ignore my patch.
________________________________________
发件人: David Laight <David.Laight@...LAB.COM>
发送时间: 2022年3月15日 18:05:24
收件人: 白浩文; freude@...ux.ibm.com; hca@...ux.ibm.com; gor@...ux.ibm.com; agordeev@...ux.ibm.com
抄送: linux-s390@...r.kernel.org; linux-kernel@...r.kernel.org
主题: RE: [PATCH v2] s390: crypto: Use min() instead of doing it manually
From: Haowen Bai
> Sent: 15 March 2022 08:01
>
> Fix following coccicheck warning:
> drivers/s390/crypto/zcrypt_ep11misc.c:1112:25-26: WARNING opportunity for min()
>
> Signed-off-by: Haowen Bai <baihaowen@...zu.com>
> ---
> drivers/s390/crypto/zcrypt_ep11misc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/s390/crypto/zcrypt_ep11misc.c b/drivers/s390/crypto/zcrypt_ep11misc.c
> index 9ce5a71..bb2a527 100644
> --- a/drivers/s390/crypto/zcrypt_ep11misc.c
> +++ b/drivers/s390/crypto/zcrypt_ep11misc.c
> @@ -1109,7 +1109,7 @@ static int ep11_wrapkey(u16 card, u16 domain,
> if (kb->head.type == TOKTYPE_NON_CCA &&
> kb->head.version == TOKVER_EP11_AES) {
> has_header = true;
> - keysize = kb->head.len < keysize ? kb->head.len : keysize;
> + keysize = min((size_t)kb->head.len, keysize);
I'm sure that would look better as:
if (keysize > kb->head.len)
keysize = kb->head.len;
which makes it much more obvious that the existing value
is being limited by a new bound.
David
> }
>
> /* request cprb and payload */
> --
> 2.7.4
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists