Re: [bug report] [PATCH] dvb: b2c2/flexcop driver refactoring part 2: add modular Flexcop driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

On Sat, May 04, 2024 at 02:24:21PM +0300, Dan Carpenter wrote:
> [ This patch is 19 years old now...  :P  Sorry!  - dan ]
> 
> Commit 2add87a95068 ("[PATCH] dvb: b2c2/flexcop driver refactoring
> part 2: add modular Flexcop driver") from May 16, 2005 (linux-next),
> leads to the following Smatch static checker warning:

I think the patches were from Patrick and misattributed because
I was too stupid to operate git correctly at the time.

> 	drivers/media/usb/b2c2/flexcop-usb.c:199 flexcop_usb_memory_req()
> 	warn: iterator 'i' not incremented

> --> 199         for (i = 0; i < len;) {
> 
> No i++.

>     208                 ret = flexcop_usb_v8_memory_req(fc_usb, req,
>     209                         page_start + (addr / V8_MEMORY_PAGE_SIZE),
>     210                         (addr & V8_MEMORY_PAGE_MASK) |
>     211                                 (V8_MEMORY_EXTENDED*extended),
>     212                         &buf[i], pagechunk);
>                                 ^^^^^^^^
> I think adding an i++ doesn't make sense.  Are we really writing a byte
> at a time?
C> 
>     213 
>     214                 if (ret < 0)
>     215                         return ret;
>     216                 addr += pagechunk;
>     217                 len -= pagechunk;
>     218         }

The loop is weird, but I guess it worked because the len -= pagechunk
would have terminated the loop and supposedly there was only one
iteration ever. I doubt anyone has hardware to test it, so don't
change it. Well, I certainly won't touch it, you can do it if you want.


Johannes




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux