Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp571036rwe; Wed, 31 Aug 2022 07:29:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR5oj/odtMQMN/oKW+AUWXDBIqm2AUO1L1JyaivMtFMAAiOnYwAIaC+o0B+W/5yxX1m+HDrI X-Received: by 2002:a63:e507:0:b0:42c:65d3:f3b6 with SMTP id r7-20020a63e507000000b0042c65d3f3b6mr9606083pgh.395.1661956190443; Wed, 31 Aug 2022 07:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661956190; cv=none; d=google.com; s=arc-20160816; b=dD2R/oMwhLlpQKW9pddIauI/HYmmhYA2y8bRuezKEasvJiQA8+k8xYAL+GvFkVM5Ex 5FskqJXoABMFd7WlbrZJFuTUOcpEzEgMR8SDNdSgLux7jR8gM36rc5pYSOxv/h/2hk1a /bpoZAlUU7dB1ufjtKahbuWwixvHYPGTohT2PM1egqRwX3IGY6FxYYmhKMQMOiuB1FEl XgzGxpeZPs3tsCksxtlaa4xdw3N383mhUKNebG7kTe20PVX5yoQvr5pHzFr+5p2XlKuj tUz/EJzUHASWQa3cnQSKmQNyPQg3qJDgZEgkvH3V1rKAcPP37i2WIFunI6fkK/41D7Ah UqvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ACBufhRCmNobOBx3xuNTiZdfWSZDve3HUA73HlNYNKk=; b=xAPL/JFRqlG+7PcAAAt1VEbUT8gkBSvVGxkadzI1gLt3ASTD4qzG3bTSCauaic3QlE 4jk9lxFSDP7PTDHL6Hk2W9EUd3WF/W21iXa2Ve0HtFIdQWZtKPhX2z5ouurVzWa/NfMP 62lASRqEGB8O68c2RkZ52F2zeqjamUEOA+rNPExDpN2P0GLcvHsv1N7eZ0fkMBf43Y+q kKpk+L2FXmpdWP5P9jE/w3jM9yVdh5xuqsky7kqGLM3uWRJZUa9JFl6s24ZteTim2y0I wgqMPQml8Ky4gQTt70qtqt7z9u4bpEty6MZn3U4nziNdvOVTmQJbC/22OXx6L+g7PRtk Q2jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Iz++nKzw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq5-20020a17090b380500b001fdb2692f15si2185435pjb.174.2022.08.31.07.29.39; Wed, 31 Aug 2022 07:29:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Iz++nKzw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231484AbiHaNqT (ORCPT + 99 others); Wed, 31 Aug 2022 09:46:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231851AbiHaNqN (ORCPT ); Wed, 31 Aug 2022 09:46:13 -0400 Received: from mail-vs1-xe2c.google.com (mail-vs1-xe2c.google.com [IPv6:2607:f8b0:4864:20::e2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 718CD2B193; Wed, 31 Aug 2022 06:45:09 -0700 (PDT) Received: by mail-vs1-xe2c.google.com with SMTP id n125so14647001vsc.5; Wed, 31 Aug 2022 06:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=ACBufhRCmNobOBx3xuNTiZdfWSZDve3HUA73HlNYNKk=; b=Iz++nKzwy0wNqjxVcgAKJtVF4fJfLqOLDKwBI4WKoAd1dfqgnkH1Ck64ytng/gV+92 TkZfPuuTUqSN+aFyxDbWDAM2LHD2tt3dDproFKAQFy4eG0EhhfilC6Vk1Sr7RDTIAyVE aVpTpvljBLcDGsvYx6eqICLk7Xatq2/pzDkXz78D8R8VajQ/0GCws71OPRgWf/aQqojH lcTTbuQ73sPKvpUAFiwQteu92j3kfjIWM9Spd0nMWVO3tQQBnpU1B73og3zNv3L6Fwh4 YKz4rdmsOYRGQBDeT9+EdDdaZ7E8pRwt569mxl4L0+KkLeAQoVoi/TrwXR3EISeH5uZu 1ycQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=ACBufhRCmNobOBx3xuNTiZdfWSZDve3HUA73HlNYNKk=; b=0Px77TraLuiOKmFpFipzxCKF+J5ScebZFUh5+knkgyPxNELipEF/uW5RhDR/VRiosH mcAqY8jpd0cP3/EBOFc29KXW26EvkxbrOpxFiZz2S05qOhj6T0L+ttrqHWRhcKwVK5uK xcv6VTTgYgJjP8ld+HbZ3b+UWD+Pz2Bl+WpmKavWca03EPwHF/SPnzTSs4PFBaadRvI0 rb6J9jNBMfEf7aBLj9cX6ROV2o4xOA3SHScWqnPzb87BBxZJwVojVKvNhdJt4Y+pBnzo iQFzzLBcz6Cl5ZPBUzXdiZK8TF/VkpLIaLEXtjSGL5T+Jfl3zXpbwMFTSN4mazQ8GxAi SA2A== X-Gm-Message-State: ACgBeo2LqdVEiTNZzjA179SyLlaAlq0PFf4MXn5Eym8TyXIhxqvUd7qa 3dcsvkNvGmvkn8mONqtqckv6UXrIyYxreYaWgko= X-Received: by 2002:a67:dd04:0:b0:392:96d5:37e with SMTP id y4-20020a67dd04000000b0039296d5037emr2339035vsj.44.1661953508602; Wed, 31 Aug 2022 06:45:08 -0700 (PDT) MIME-Version: 1.0 References: <165590120140.1149771.2257818527859865760@Monstersaurus> <4883f0a7-6a1b-31bd-33fe-db8f6dcf73fa@selasky.org> In-Reply-To: From: =?UTF-8?B?7Jyg7Jqp7IiY?= Date: Wed, 31 Aug 2022 22:45:00 +0900 Message-ID: Subject: Re: [PATCH] media: dvb_ringbuffer : Fix a bug in dvb_ringbuffer.c To: Hans Petter Selasky , Kieran Bingham , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, mchehab@kernel.org Cc: 0215yys@hanmail.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: X-Mailing-List: linux-kernel@vger.kernel.org Dear All, Can you share how this patch is going ? 2022=EB=85=84 8=EC=9B=94 18=EC=9D=BC (=EB=AA=A9) =EC=98=A4=ED=9B=84 9:55, = =EC=9C=A0=EC=9A=A9=EC=88=98 =EB=8B=98=EC=9D=B4 =EC= =9E=91=EC=84=B1: > > Dear All, > > Can you pay your attention to this patch ? > This is a very simple modification. > But, too much time has already passed since I sent the first E-mail. > > 2022=EB=85=84 8=EC=9B=94 3=EC=9D=BC (=EC=88=98) =EC=98=A4=ED=9B=84 9:04, = =EC=9C=A0=EC=9A=A9=EC=88=98 =EB=8B=98=EC=9D=B4 =EC= =9E=91=EC=84=B1: > > > > Dear All. > > Too much time has already passed since I first sent this Email. > > Can you share how this patch is going ? > > > > 2022=EB=85=84 6=EC=9B=94 23=EC=9D=BC (=EB=AA=A9) =EC=98=A4=ED=9B=84 6:1= 1, =EC=9C=A0=EC=9A=A9=EC=88=98 =EB=8B=98=EC=9D=B4 = =EC=9E=91=EC=84=B1: > > > > > > Dear Kieran Bingham > > > > > > I sent E-mail again by Linux terminal by using the command " ... git > > > send-email .." > > > I believe that you will surely get the diff file. > > > > > > Thank you > > > > > > 2022=EB=85=84 6=EC=9B=94 22=EC=9D=BC (=EC=88=98) =EC=98=A4=ED=9B=84 1= 0:12, Hans Petter Selasky =EB=8B=98=EC=9D=B4 =EC=9E=91=EC= =84=B1: > > > > > > > > Hi Kieran, > > > > > > > > The consumed variable should not be negative. This bug has been the= re > > > > since the beginning of the GIT at Linux from what I can see. > > > > > > > > +1 > > > > > > > > --HPS > > > > > > > > From 108c6acb2cc4bc4314b96f6f254a04b2873a096c Mon Sep 17 00:00:00 = 2001 > > > > From: YongSu Yoo > > > > Date: Sun, 22 May 2022 04:53:12 +0000 > > > > Subject: [PATCH] media: dvb_ringbuffer : Fix a bug in dvb_ringbuffe= r.c > > > > > > > > Signed-off-by:Yongsu Yoo > > > > > > > > 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 =3D (idx + curpktlen + DVB_RINGBUFFER_PKTHDRSIZ= E) % rbuf->size; > > > > } > > > > > > > > - consumed =3D (idx - rbuf->pread) % rbuf->size; > > > > + consumed =3D (idx - rbuf->pread); > > > > + if (consumed < 0) > > > > + consumed +=3D rbuf->size; > > > > > > > > while((dvb_ringbuffer_avail(rbuf) - consumed) > > > > > DVB_RINGBUFFER_PKTHDRSIZE) { > > > > > > > > -- > > > > 2.17.1