lkml.org 
[lkml]   [2021]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] char: pcmcia: remove set but not used variable 'tmp'
On Sat, May 15, 2021 at 9:15 AM yukuai (C) <yukuai3@huawei.com> wrote:
> On 2021/05/14 14:28, Arnd Bergmann wrote:
>
> I'm not familar with the logical here, however, if io_read_num_rec_bytes
> may get 'num_bytes_read' greater than 4, this loop will cause index out
> of boundary. It make sense to me to add a range check. Futhermore, since
> 'num_bytes_read' is ensure to >= 4,I think we can change the loop to:
>
> for (i = 0; i < 4; ++i) {
> xoutb(i, REG_BUF_ADDR(iobase));
> pts_reply[i] = inb(REG_BUF_DATA(iobase));
> }

Obviously it still has to use the num_bytes_read value to determine
how many bytes were actually received, but there should be an
added cap to tell the compiler that this is never more than 4.

Arnd

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