Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: dvb_demux: fix a bug for the continuity counter

In dvb_demux.c, some logics exist which compare the expected
continuity counter and the real continuity counter. If they
are not matched each other, both of the expected continuity
counter and the real continuity counter should be printed.
But there exists a bug that the expected continuity counter
is not correctly printed. The expected continuity counter is
replaced with the real countinuity counter + 1 so that
the epected continuity counter is not correclty printed.
This is wrong. This bug is fixed.

Link: https://lore.kernel.org/linux-media/20230305212519.499-1-yongsuyoo0215@gmail.com

Signed-off-by: YongSu Yoo <yongsuyoo0215@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

YongSu Yoo and committed by
Mauro Carvalho Chehab
7efb10d8 53558de2

+2 -2
+2 -2
drivers/media/dvb-core/dvb_demux.c
··· 115 115 116 116 cc = buf[3] & 0x0f; 117 117 ccok = ((feed->cc + 1) & 0x0f) == cc; 118 - feed->cc = cc; 119 118 if (!ccok) { 120 119 set_buf_flags(feed, DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED); 121 120 dprintk_sect_loss("missed packet: %d instead of %d!\n", 122 121 cc, (feed->cc + 1) & 0x0f); 123 122 } 123 + feed->cc = cc; 124 124 125 125 if (buf[1] & 0x40) // PUSI ? 126 126 feed->peslen = 0xfffa; ··· 300 300 301 301 cc = buf[3] & 0x0f; 302 302 ccok = ((feed->cc + 1) & 0x0f) == cc; 303 - feed->cc = cc; 304 303 305 304 if (buf[3] & 0x20) { 306 305 /* adaption field present, check for discontinuity_indicator */ ··· 335 336 feed->pusi_seen = false; 336 337 dvb_dmx_swfilter_section_new(feed); 337 338 } 339 + feed->cc = cc; 338 340 339 341 if (buf[1] & 0x40) { 340 342 /* PUSI=1 (is set), section boundary is here */