lkml.org 
[lkml]   [2022]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/7] tty/vt: consolemap: use ARRAY_SIZE(), part II.
From
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 <jslaby@suse.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++) {
>
> 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

\
 
 \ /
  Last update: 2022-06-14 11:05    [W:2.059 / U:1.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site