[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ff8d1f-c12-67c8-6ebd-57b4466ecb16@linux.intel.com>
Date: Tue, 14 Jun 2022 11:32:33 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Jiri Slaby <jirislaby@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
cc: linux-serial <linux-serial@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/7] tty/vt: consolemap: use ARRAY_SIZE(), part II.
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 <jslaby@...e.cz>
> > ---
> > 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 <ilpo.jarvinen@...ux.intel.com>
This patch is not fine so I take my rev-by back.
--
i.
Powered by blists - more mailing lists