From patchwork Thu Mar 9 08:09:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 662050 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5867C61DA4 for ; Thu, 9 Mar 2023 08:09:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230043AbjCIIJk (ORCPT ); Thu, 9 Mar 2023 03:09:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbjCIIJg (ORCPT ); Thu, 9 Mar 2023 03:09:36 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07E7480922; Thu, 9 Mar 2023 00:09:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678349375; x=1709885375; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RK695QH/y82SbaTTSnPKZdcNJwX827c00O+m1L7g7qE=; b=S7iMbP/eCPROpH3jQZPd2/55QhgpBmv749/IHj7tszQuvRnvQa920H9c 0s4Lsp7v+bV9EcUSibBucP4BJvElyzfMfrT3BaqgFFsldNB8fIt8NdB3z RgDS40wAI//M/Uv6gX89F1dTjE8nfmZlW7Jb+lqrjmv99pK5AcYcXVT3H sgN1f4n+U829+20sN7rbCzyffnGS9ePHQhrOyRPIXGiH9sxNGrIMrugjS 90qU3jJ2lCqzdsY430FFKpUmntdBwzFvVCsEMI46fVjjGjUAM2NBcyUvj TN8M1fulrVeXJyvTUZiPdfdhBtOT3P46SzfJqfD/UQPKWkkNRuPgxX3xk A==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="333853545" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="333853545" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:09:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="746227955" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="746227955" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:09:34 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 1/8] serial: Use ARRAY_SIZE() with iso7816 reserved array Date: Thu, 9 Mar 2023 10:09:16 +0200 Message-Id: <20230309080923.11778-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309080923.11778-1-ilpo.jarvinen@linux.intel.com> References: <20230309080923.11778-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Instead of a literal, size the for loop iteration based on the actual array using ARRAY_SIZE(). Signed-off-by: Ilpo Järvinen --- 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;