Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp321381imn; Wed, 3 Aug 2022 05:23:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR4mMs1gPqWi6Aqujm20qcZCTWApxFZSoyfEvQ/BQRh6dR2Re2P2dp1iAKrK1jekC0/PXL39 X-Received: by 2002:a17:902:ec91:b0:16f:176f:ec98 with SMTP id x17-20020a170902ec9100b0016f176fec98mr1840951plg.141.1659529384238; Wed, 03 Aug 2022 05:23:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659529384; cv=none; d=google.com; s=arc-20160816; b=F0sJKOkPQhJwL6RG2unWkELtPAXJWregUrBH6mJIsEdWUoAOx5JzxYmebRxTJJCYIE C8kjCloBUU2tQh1w4D5dXVLXcyaN8t2rxD5vGhNPIRM6LFLywzqcdExSnxb+lRW1TYcF pjFMeoVqJD+KT11izjyX+I/WLssGHMchfGdklUKfvLsWdVpRWVlA8YUasezCn0W2XGVn y4KpnHND9jDPybyj2ymuvLakJ/U3RMc2J/PpjuMzpTprurolSuht42uXyPOhww5U7RRz rZ7qqZ/GRW/4c9sYe6XiDjKGp1hFmvkXc4z9ZrTZDJr0NrQfD+XHm7/Y/q23FYKhw81M fSzw== 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=HdGfOeXezbgbP8QayfnATfWBu9OsYip9xRe8mOklBIU=; b=MOPsDjx8yDQi30J7lEtOOQYEmprQRlebDoLZY5LiYUpcXGPLTybRpb/HVWOeThwhsd 95rpM3yvzPt2bX3Syor4ZwFYZ9MpZJvvuqYrY3etC1hYGBFWNFyvXEJsYuiItaJ0SUyV gRY/JNCyuci75gEkRuRB8q5Sl9AwvrRxr2BBg/DTy3/S2lCCJ74+7kpjt2PrR+UZArx3 zkbGxSCjapuyw0ut0M3CHsSoq3PjeJz4UwaNC836X3kLWwWgv5XL7TMuu4b9TeQpVVUn wbayw9hlxgMnMWFOEPbVFFhrTRFemgdrk+KgyZ0Ww+9e3qLRWwsgKywaSYx9ExFzaffh Lejg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Yld7l631; 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 e15-20020a17090301cf00b0016bd8e4267csi2598594plh.188.2022.08.03.05.22.39; Wed, 03 Aug 2022 05:23:04 -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=Yld7l631; 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 S237733AbiHCMFF (ORCPT + 99 others); Wed, 3 Aug 2022 08:05:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233640AbiHCMFD (ORCPT ); Wed, 3 Aug 2022 08:05:03 -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 820391A072; Wed, 3 Aug 2022 05:04:59 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id z187so6347941pfb.12; Wed, 03 Aug 2022 05:04:59 -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; bh=HdGfOeXezbgbP8QayfnATfWBu9OsYip9xRe8mOklBIU=; b=Yld7l631oi7+tpGn2LNv1r9k2u5LqzevMC3SrNO59N0kMRFPtcjsbLfolY7UC+5bSG sQSQi1jnYV8dkbCE4CcAI4IJdN/g+uTCLqgxxvXp8/sRrMUyrYevsjnccK82GbLnLrvb jZ3A5FtFAJT75izRgKquodxyRyUK6FGaUWCesNegPU/Dec8EKV/3/lmhRZXHAczh+18a /qLLoUzO0VhxJZgcLS0YcIv7OsGsfJSl+4nllmAzsB1nMdGU8qAqzzfPgrpQURVAjjHw kDsdFEfLV6xD49wES8JcKdkD47kA8Vvb3StYMZ5km8aD8x49XxQ35vyPdaUiVM5NXlaw Z2tQ== 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; bh=HdGfOeXezbgbP8QayfnATfWBu9OsYip9xRe8mOklBIU=; b=xwIfT5oN7KJJ/To6HBSfpVadJsoWaknojXiL4n2s7v284Tvp/HlCtYp5/gcKFBpfwe E/4OGqM9+ulTwD9g2tzIF609f09OrHNitMMfFerTpIphaworW19wpsGemE9r4TdlQIcs hR3YuE01HD1HPyH2Fc5NBsFvzh9bSz1M/GWJVfTqrrrUZzzVj4d1u7YSAi5HcOUGFL54 GR9Hd+wPehPUqq5IyXayS6Hij6sY/MZxet5Zz5R0tOxtyAKMmTaLrjwlen5Za70AmPJ9 /2syHdVQd1p7hN0RnfxC8rdNAHCBZZfaw1FnjnkWXxF/3Q7zZcbHfWLAXJxdx7A3dQ4X tPPA== X-Gm-Message-State: AJIora9VtSnH6vGkPTTtMY717xNjGIjBp295GGQ/pVnxevLVxKTPfQud KhMgy8KpJqSMxlaRzVVjemKnsATyUeduD9JML1s= X-Received: by 2002:a63:570b:0:b0:41a:5129:42d3 with SMTP id l11-20020a63570b000000b0041a512942d3mr21078017pgb.216.1659528299014; Wed, 03 Aug 2022 05:04:59 -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, 3 Aug 2022 21:04:51 +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: =?UTF-8?B?7Jyg7Jqp7IiY?= , 0215yys@hanmail.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 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 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. 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:11, = =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 10: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 there > > 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_ringbuffer.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_PKTHDRSIZE) %= 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