From eff37b5ea3d92c9d33a7e543460a565d17909ae4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ilpo=20J=C3=A4rvinen?= Date: Thu, 9 Mar 2023 10:09:16 +0200 Subject: [PATCH] serial: Use ARRAY_SIZE() with iso7816 reserved array MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Instead of a literal, size the for loop iteration based on the actual array using ARRAY_SIZE(). Signed-off-by: Ilpo Järvinen Link: https://lore.kernel.org/r/20230309080923.11778-2-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/serial_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 2bd32c8ece39..ee2aabcc8943 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -1491,7 +1492,7 @@ static int uart_set_iso7816_config(struct uart_port *port, * There are 5 words reserved for future use. Check that userspace * doesn't put stuff in there to prevent breakages in the future. */ - for (i = 0; i < 5; i++) + for (i = 0; i < ARRAY_SIZE(iso7816.reserved); i++) if (iso7816.reserved[i]) return -EINVAL; -- 2.34.1