[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87bjuhpmmt.wl-kuninori.morimoto.gx@renesas.com>
Date: Tue, 4 Mar 2025 02:15:07 +0000
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
To: Andy Shevchenko <andy@...nel.org>, Kees Cook <kees@...nel.org>, linux-hardening@...r.kernel.org
Subject: [SAMPLE] crypto: nx: pseries: use string choices helper
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
---
drivers/crypto/nx/nx-common-pseries.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/crypto/nx/nx-common-pseries.c b/drivers/crypto/nx/nx-common-pseries.c
index 1660c5cf3641..1f8a73fb6bdd 100644
--- a/drivers/crypto/nx/nx-common-pseries.c
+++ b/drivers/crypto/nx/nx-common-pseries.c
@@ -7,6 +7,7 @@
* Authors: Robert Jennings <rcj@...ux.vnet.ibm.com>
* Seth Jennings <sjenning@...ux.vnet.ibm.com>
*/
+#include <linux/string_choices.h>
#include <asm/vio.h>
#include <asm/hvcall.h>
@@ -55,13 +56,13 @@ static int check_constraints(unsigned long buf, unsigned int *len, bool in)
{
if (!IS_ALIGNED(buf, nx842_pseries_constraints.alignment)) {
pr_debug("%s buffer 0x%lx not aligned to 0x%x\n",
- in ? "input" : "output", buf,
+ str_input_output(in), buf,
nx842_pseries_constraints.alignment);
return -EINVAL;
}
if (*len % nx842_pseries_constraints.multiple) {
pr_debug("%s buffer len 0x%x not multiple of 0x%x\n",
- in ? "input" : "output", *len,
+ str_input_output(in), *len,
nx842_pseries_constraints.multiple);
if (in)
return -EINVAL;
@@ -69,13 +70,13 @@ static int check_constraints(unsigned long buf, unsigned int *len, bool in)
}
if (*len < nx842_pseries_constraints.minimum) {
pr_debug("%s buffer len 0x%x under minimum 0x%x\n",
- in ? "input" : "output", *len,
+ str_input_output(in), *len,
nx842_pseries_constraints.minimum);
return -EINVAL;
}
if (*len > nx842_pseries_constraints.maximum) {
pr_debug("%s buffer len 0x%x over maximum 0x%x\n",
- in ? "input" : "output", *len,
+ str_input_output(in), *len,
nx842_pseries_constraints.maximum);
if (in)
return -EINVAL;
--
2.43.0
Powered by blists - more mailing lists