Message ID | 20220623103543.4138-1-yongsuyoo0215@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Headers |
Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from <linux-media-owner@vger.kernel.org>) id 1o4KBw-00FpTA-Vv; Thu, 23 Jun 2022 10:36:08 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230253AbiFWKgC (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Thu, 23 Jun 2022 06:36:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230461AbiFWKf7 (ORCPT <rfc822;linux-media@vger.kernel.org>); Thu, 23 Jun 2022 06:35:59 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8375A4AE3A; Thu, 23 Jun 2022 03:35:58 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id i64so18707425pfc.8; Thu, 23 Jun 2022 03:35:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=tVwbL6nVPQa+IvvtvNiiIvdVzr4byypsu+RDuuj+PyE=; b=dvotv9yYIToSOJdOkjf4z5IpXImZfcOqikT6k+4twfSS9LKaDnpuGPFZBUYjhaMUE5 OMB5m4c3VSlHZ5Xxj/sk7diiUITXjeVwwn3T/2y1UFAloCn9DkN4P6/hVqs8GrEXXouh 7KPVaHs3T9h8/MsDeeMcjlk5mh9/WKwgyNDGiUVXS2lb/QE+WKcZyimdMaumYyudwYrU uyC1IbrB7+oXV4kBGRlHjaHVlFdf2OSsZpew43fApQ1WuxsqovBB6b/6AHTz1rZPEWiU /WIE+5yUr2YunTCRYuFOJbQ/YQfGnkyFTfZctVeXMWjr5s5Mf46lJuYLM5DUyYBem2Qv 8YSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tVwbL6nVPQa+IvvtvNiiIvdVzr4byypsu+RDuuj+PyE=; b=tFMaEt3MJfPD4pLD6i6FkjxMJgZdCGgdhqtGafS5hbsVSDH9kF9ZE64BB8XfR6HIZf 1oonTBkDlhfjdgKqKMe3wBx7QZrkWR6dqyM8IulZQVFDgoYUjjTj0jhDPhN6KMhWra0V RJEzX38Brb/w8IfNSVcbMsVPPtw0obSjdWfw2Zostln28ONW56tVHj1QePzuhDg73F1C aScbY/SVO959uI2T3mSqgJFMxml/YtRUhfJYZ0VIF6KXaixKcwiFvc9aECczOIqVYgsA 6mYRZhvrlxH736pc4BjP61Wl09OY6foo/dIhewRZgOBeQFAV0zd+SxqjU1o0hwEO0Zx3 vUtA== X-Gm-Message-State: AJIora/AFiKd6/JYVj0OAinD26/4mZV3kKZaQ/u3+W7AzNJCjJl+zjK4 PGUQ4w93I7LF7Hyxm4TeynMwnTfhH8W0yHN57q8= X-Google-Smtp-Source: AGRyM1v7Gvnbat5ZdugL79CKL7xNN70Bp+0Cwkn/A0cLe9T7RQunDUxGQMJHTfWll14ucXktLu3hRQ== X-Received: by 2002:a05:6a00:1a0e:b0:523:1e7c:e26e with SMTP id g14-20020a056a001a0e00b005231e7ce26emr39726732pfv.60.1655980557866; Thu, 23 Jun 2022 03:35:57 -0700 (PDT) Received: from goorm.ap-northeast-2.compute.internal (ec2-15-164-162-188.ap-northeast-2.compute.amazonaws.com. [15.164.162.188]) by smtp.gmail.com with ESMTPSA id d5-20020a170902cec500b0016a4db1342esm3026608plg.193.2022.06.23.03.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 03:35:57 -0700 (PDT) From: YongSu Yoo <yongsuyoo0215@gmail.com> To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, mchehab@kernel.org, hps@selasky.org, kieran.bingham@ideasonboard.com Cc: YongSu Yoo <yongsuyoo0215@gmail.com> Subject: [PATCH] media: dvb_ringbuffer : Fix a bug in dvb_ringbuffer.c Date: Thu, 23 Jun 2022 10:35:43 +0000 Message-Id: <20220623103543.4138-1-yongsuyoo0215@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,FREEMAIL_FORGED_FROMDOMAIN=0.001,FREEMAIL_FROM=0.001,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no |
Series |
media: dvb_ringbuffer : Fix a bug in dvb_ringbuffer.c
|
|
Commit Message
YongSu Yoo
June 23, 2022, 10:35 a.m. UTC
Signed-off-by:Yongsu Yoo <yongsuyoo0215@gmail.com> The function dvb_ringbuffer_pkt_next in /linux-next/drviers/media/dvb-core/dvb_ringbuffer.c, which searches the idx of the next valid packet in the ring buffer of the ca->slot_info[slot].rx_buffer at /linux-next/drivers/media/dvb-core/dvb_ca_en50221.c, has the following problem. In calculating the amounts of the consumed address of the ring buffer, if the read address(rbuf->pread) of the ring buffer is smaller than the idx, the amounts of the searched address should be (idx - rbuf->pread), whereas if the read address(rbuf->pread) of the ring buffer is larger than the idx, the amounts of the consumed address should be (idx - rbuf->pread + rbug->size). But there exists an incorrect logic that the rbug-size was not properly added on (idx - rbug->pread) in the later case. With this commit, we fixed this bug. --- drivers/media/dvb-core/dvb_ringbuffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Comments
Hi ~ How is this patch going ? Can you share current status ? Thank you 2022년 6월 23일 (목) 오후 7:35, YongSu Yoo <yongsuyoo0215@gmail.com>님이 작성: > > Signed-off-by:Yongsu Yoo <yongsuyoo0215@gmail.com> > > The function dvb_ringbuffer_pkt_next in > /linux-next/drviers/media/dvb-core/dvb_ringbuffer.c, > which searches the idx of the next valid packet in the ring > buffer of the ca->slot_info[slot].rx_buffer at > /linux-next/drivers/media/dvb-core/dvb_ca_en50221.c, > has the following problem. > In calculating the amounts of the consumed address of the ring > buffer, if the read address(rbuf->pread) of the ring buffer is > smaller than the idx, the amounts of the searched address > should be (idx - rbuf->pread), > whereas if the read address(rbuf->pread) of the ring buffer is > larger than the idx, the amounts of the consumed address should > be (idx - rbuf->pread + rbug->size). But there exists an > incorrect logic that the rbug-size was not properly added on > (idx - rbug->pread) in the later case. With this commit, we > fixed this bug. > --- > drivers/media/dvb-core/dvb_ringbuffer.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/dvb-core/dvb_ringbuffer.c b/drivers/media/dvb-core/dvb_ringbuffer.c > index d1d471af0636..7d4558de8e83 100644 > --- a/drivers/media/dvb-core/dvb_ringbuffer.c > +++ b/drivers/media/dvb-core/dvb_ringbuffer.c > @@ -335,7 +335,9 @@ ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, size_t* > idx = (idx + curpktlen + DVB_RINGBUFFER_PKTHDRSIZE) % rbuf->size; > } > > - consumed = (idx - rbuf->pread) % rbuf->size; > + consumed = (idx - rbuf->pread); > + if (consumed < 0) > + consumed += rbuf->size; > > while((dvb_ringbuffer_avail(rbuf) - consumed) > DVB_RINGBUFFER_PKTHDRSIZE) { > > -- > 2.17.1 >
On 6/26/22 23:11, 유용수 wrote: > Hi ~ > > How is this patch going ? > Can you share current status ? > > Thank you > Hi Yongsu, Linux guys can sometimes take a long time to include patches speaking weeks and months. For now I've added your patch to multimedia/webcamd (v5.17.1.1) which runs under FreeBSD 13.1 (not Linux). https://github.com/hselasky/webcamd/commit/0e4d4959a2aea2e6a88d316eb943592fe0b23d09 --HPS
Dear Hans Petter Selasky Thank you for your response and good advice and informations Dear All How is this patch going ? Is there anyone who can share the current status ? 2022년 6월 30일 (목) 오후 10:42, Hans Petter Selasky <hps@selasky.org>님이 작성: > > On 6/26/22 23:11, 유용수 wrote: > > Hi ~ > > > > How is this patch going ? > > Can you share current status ? > > > > Thank you > > > > Hi Yongsu, > > Linux guys can sometimes take a long time to include patches speaking > weeks and months. For now I've added your patch to multimedia/webcamd > (v5.17.1.1) which runs under FreeBSD 13.1 (not Linux). > > https://github.com/hselasky/webcamd/commit/0e4d4959a2aea2e6a88d316eb943592fe0b23d09 > > --HPS
Dear All 2 months have already passed since I sent the first E-mail. Can you pay your attention to this patch ? Can you take care of this patch ? 2022년 7월 7일 (목) 오후 5:36, 유용수 <yongsuyoo0215@gmail.com>님이 작성: > > Dear Hans Petter Selasky > Thank you for your response and good advice and informations > > Dear All > How is this patch going ? > Is there anyone who can share the current status ? > > 2022년 6월 30일 (목) 오후 10:42, Hans Petter Selasky <hps@selasky.org>님이 작성: > > > > On 6/26/22 23:11, 유용수 wrote: > > > Hi ~ > > > > > > How is this patch going ? > > > Can you share current status ? > > > > > > Thank you > > > > > > > Hi Yongsu, > > > > Linux guys can sometimes take a long time to include patches speaking > > weeks and months. For now I've added your patch to multimedia/webcamd > > (v5.17.1.1) which runs under FreeBSD 13.1 (not Linux). > > > > https://github.com/hselasky/webcamd/commit/0e4d4959a2aea2e6a88d316eb943592fe0b23d09 > > > > --HPS
diff --git a/drivers/media/dvb-core/dvb_ringbuffer.c b/drivers/media/dvb-core/dvb_ringbuffer.c index d1d471af0636..7d4558de8e83 100644 --- a/drivers/media/dvb-core/dvb_ringbuffer.c +++ b/drivers/media/dvb-core/dvb_ringbuffer.c @@ -335,7 +335,9 @@ ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, size_t* idx = (idx + curpktlen + DVB_RINGBUFFER_PKTHDRSIZE) % rbuf->size; } - consumed = (idx - rbuf->pread) % rbuf->size; + consumed = (idx - rbuf->pread); + if (consumed < 0) + consumed += rbuf->size; while((dvb_ringbuffer_avail(rbuf) - consumed) > DVB_RINGBUFFER_PKTHDRSIZE) {