Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1256407iog; Tue, 14 Jun 2022 02:26:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyY2dsRFFxoJjNJiTRoTgChbw94UWYr5kSv1QxU9rM3bP+0+lh26v4n0nQTmHVMCcPCgX26 X-Received: by 2002:a63:5304:0:b0:3db:2e57:6f34 with SMTP id h4-20020a635304000000b003db2e576f34mr3731155pgb.88.1655198810289; Tue, 14 Jun 2022 02:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655198810; cv=none; d=google.com; s=arc-20160816; b=L6WEg8isFnxR8ecmgU+XDIk/ydrN5T9ikjzigBSzexMHvkt8TXNLYhIS99oFHAtlRj v9G9ArbjpHcn/34zSwN+34VI1mvO03LcRUXvR5xXmKSifVdWCmLYqb/Xlfqi+XLdSy3i higm65w18FO8GY6BUxD7mhQP8B6nknsLLetOXSlQjPNPXqDCEoAC76g6SgIzXU0bZvn2 lc0ynhGYBcn6uPTUpyQIi14kcKg44syjs+mInU/hgpzU/3xk0RAI4SjhKPyIjwzCVeYn 4iB1GCXjmDcPjg77WMEMnN+bUMLi1AbVJL+geSjbofSK6cls8vfZeYrkYqAZtkGSYH98 eREg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=ZalrUwXcMUE8CIDPQn8NdTkEdaFMvMEgN/XeVrNXZ54=; b=au3LqVm6pW9rIQMhESelp/QU2lwQfVmJPO69FEAWyxQzgqy+Ob3Q3M0edYFTlwema+ xvSEIb3wnGZb6bVXnLh5gTbAb5G9AyDl7EqAUITJaK66ruD/ma2FoB1aP0GGP5Iw0DDI C++W2LGml4jMF+4oDXX6oP7rw48hAfCjLGYUiivWweby0gLNu4dIf1ppKPb4anuKQXfL 7/7Ur1kxsmYghkhgxFEEsbTxpCOVWXpyCO0VfQHyWNupyrDASYZhpYELZ9P8Gljv+u7Z YotSfPGetpLGzOKGQr3nUkOrNhi5fm8h1dpLjwsxLi/2ncC4/R4xOajT3Eii4qjl13wf CocA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=H7ybuSDC; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j11-20020a63230b000000b004019a45b5easi12751556pgj.747.2022.06.14.02.26.38; Tue, 14 Jun 2022 02:26:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=H7ybuSDC; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236716AbiFNJDk (ORCPT + 99 others); Tue, 14 Jun 2022 05:03:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237318AbiFNJDT (ORCPT ); Tue, 14 Jun 2022 05:03:19 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFCF736E20; Tue, 14 Jun 2022 02:03:17 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 47F0021AC5; Tue, 14 Jun 2022 09:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1655197396; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZalrUwXcMUE8CIDPQn8NdTkEdaFMvMEgN/XeVrNXZ54=; b=H7ybuSDCf8e0hmfQK2WI5YmfH1VAdK1zuap9bliQFVToyLNx2tyG/UGOoDkwY2rmXzDbKH xMo+ngCJ2iiZBDppg5SNOju6qKCbLI1tIw495VFtvpJBWlf26AhDP9tIoI0iMlXQl87gaE tc1GmTAYTHhopoVOApkKn2DweLavBfw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1655197396; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZalrUwXcMUE8CIDPQn8NdTkEdaFMvMEgN/XeVrNXZ54=; b=zE9wIcsFY8YElhYssHhnnLbNj1hkES6wI39NEgL1ci9S9GOc3SILn0+9BulTLsQrPfEP+i tXukehRbrfREo4Cg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 15E07139EC; Tue, 14 Jun 2022 09:03:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Hv/OA9ROqGKiLgAAMHmgww (envelope-from ); Tue, 14 Jun 2022 09:03:16 +0000 Message-ID: <3681d7dd-94f0-5b40-85ec-5fa5e22d213f@suse.cz> Date: Tue, 14 Jun 2022 11:03:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 1/7] tty/vt: consolemap: use ARRAY_SIZE(), part II. Content-Language: en-US To: =?UTF-8?Q?Ilpo_J=c3=a4rvinen?= Cc: Greg Kroah-Hartman , linux-serial , LKML References: <20220614075713.32767-1-jslaby@suse.cz> <68107f11-58bb-5c55-8f45-891717d08d33@linux.intel.com> From: Jiri Slaby In-Reply-To: <68107f11-58bb-5c55-8f45-891717d08d33@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14. 06. 22, 10:17, Ilpo Järvinen wrote: > On Tue, 14 Jun 2022, Jiri Slaby wrote: > >> The code still uses constants (macros) as bounds in loops after commit >> 17945d317a52 (tty/vt: consolemap: use ARRAY_SIZE()). The contants are at >> least macros used also in the definition of the arrays. But use >> ARRAY_SIZE() on two more places to ensure the loops never run out of >> bounds even if the array definition change. >> >> Signed-off-by: Jiri Slaby >> --- >> drivers/tty/vt/consolemap.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c >> index fff97ae87e00..8aa7a48b3647 100644 >> --- a/drivers/tty/vt/consolemap.c >> +++ b/drivers/tty/vt/consolemap.c >> @@ -232,7 +232,7 @@ static void set_inverse_transl(struct vc_data *conp, struct uni_pagedict *p, >> } >> memset(q, 0, MAX_GLYPH); >> >> - for (j = 0; j < E_TABSZ; j++) { >> + for (j = 0; j < ARRAY_SIZE(translations[i]); j++) { > > Any particular reason why you left its definition to have 256 instead of > E_TABSZ (even after the patch series I mean): > > static unsigned short translations[][256] = { I will. (Only if it wasn't so badly chosen name. And even exported to userspace.) thanks, -- js suse labs