Re: V4L/DVB: dvb_dmx_swfilter_section_copy_dump() assignment or addition?

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

 



Hello Roel,

Roel Kluin wrote:
> vi drivers/media/dvb/dvb-core/dvb_demux.c +214
> 
> and note:
> 
> static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed,
>                                               const u8 *buf, u8 len)
> {
> 	...
>         if (sec->tsfeedp + len > DMX_MAX_SECFEED_SIZE) {
> 		...
>                 len = DMX_MAX_SECFEED_SIZE - sec->tsfeedp;
> 		    ^------------shouldn't this be '+='?

No. Read it like this: If there isn't enough space for 'len' bytes,
then reduce 'len' to the number of bytes available.

>         }
> 
> 	if (len <= 0)
>                 return 0;
> 
> Also note: len cannot be less than 0 since it's an u8.

Yes. This function seems to be overcautious in other places, too.
These two checks can probably get removed:

        if (sec->tsfeedp >= DMX_MAX_SECFEED_SIZE)
                return 0;

        if (limit > DMX_MAX_SECFEED_SIZE)
                return -1;      /* internal error should never happen */

Regards,
Andreas
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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