From mboxrd@z Thu Jan 1 00:00:00 1970 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 9C37BC43334 for ; Tue, 14 Jun 2022 08:32:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231905AbiFNIcq (ORCPT ); Tue, 14 Jun 2022 04:32:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiFNIcl (ORCPT ); Tue, 14 Jun 2022 04:32:41 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46A7764D4; Tue, 14 Jun 2022 01:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655195559; x=1686731559; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=f+zHCUo+wuXk7wCEBaujL4BGoT/2SLJqxdPfbepFi1I=; b=mrneGVgoFQ9RkmPHo28sZuQCwzUt1F+xMp8JJOF6h5IGD0EaLihRR809 yJV3UNVlb0mOm82shHeEbDZwG2dJLKO/gaHHSBimiz9qZc8rWv4+/ZXZi FVQqXsM7WrNx2Ph2bDNguzm+saV/+ysnFWZrGnbTaL/FlGz3RAJu6905w +9Tka63onWe4rZ51dlAP0AOHBHlEP1v86mEgKmqDrq0bvCCEqmQb/3Oy7 B+AB9oV8l5ja89NdJNPVwnQSwOYGsEUpoXjw8vEuzzqjRFxkugslnK87K Dj/lO7Qb37Qz9k122aphWMHjj0yhj27/UxsDmtGhYq6f+VlULq1qFe/Ts A==; X-IronPort-AV: E=McAfee;i="6400,9594,10377"; a="278588652" X-IronPort-AV: E=Sophos;i="5.91,299,1647327600"; d="scan'208";a="278588652" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2022 01:32:37 -0700 X-IronPort-AV: E=Sophos;i="5.91,299,1647327600"; d="scan'208";a="830287005" Received: from jlaghzal-mobl1.ger.corp.intel.com ([10.252.32.175]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2022 01:32:35 -0700 Date: Tue, 14 Jun 2022 11:32:33 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Jiri Slaby , Greg Kroah-Hartman cc: linux-serial , LKML Subject: Re: [PATCH 1/7] tty/vt: consolemap: use ARRAY_SIZE(), part II. In-Reply-To: <68107f11-58bb-5c55-8f45-891717d08d33@linux.intel.com> Message-ID: References: <20220614075713.32767-1-jslaby@suse.cz> <68107f11-58bb-5c55-8f45-891717d08d33@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-711606469-1655195556=:1605" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-711606469-1655195556=:1605 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8BIT Hi all, Err, I take my Reviewed-by back. I just found an issue with this commit while reviewing a later patch in the series that undos that error. On Tue, 14 Jun 2022, 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++) { There's no i variable in this function. > 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] = { > > > > glyph = conv_uni_to_pc(conp, t[j]); > > if (glyph >= 0 && glyph < MAX_GLYPH && q[glyph] < 32) { > > /* prefer '-' above SHY etc. */ > > @@ -367,7 +367,7 @@ int con_get_trans_old(unsigned char __user * arg) > > unsigned char outbuf[E_TABSZ]; > > > > console_lock(); > > - for (i = 0; i < E_TABSZ ; i++) > > + for (i = 0; i < ARRAY_SIZE(outbuf); i++) > > { > > ch = conv_uni_to_pc(vc_cons[fg_console].d, p[i]); > > outbuf[i] = (ch & ~0xff) ? 0 : ch; > > > > Reviewed-by: Ilpo Järvinen This patch is not fine so I take my rev-by back. -- i. --8323329-711606469-1655195556=:1605--