Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp432280rwb; Thu, 18 Aug 2022 06:27:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Q1pJvJe/qEbobW6u2Jm4vWITR6O7joGk4hYghoea5RhBWFp+yp2bIJTfGsxdfToJKmydX X-Received: by 2002:a17:902:b18e:b0:172:5c92:d8db with SMTP id s14-20020a170902b18e00b001725c92d8dbmr2531335plr.140.1660829278980; Thu, 18 Aug 2022 06:27:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660829278; cv=none; d=google.com; s=arc-20160816; b=PsSJGbZvl5dSPZyK5QPYIncIj+zPWHXftfjXZ4yg2G9PMmACPNLHe1T2XWDxGzdpm4 AcDcjObmLqNpLC4i7nE697yqEPjUMz0X6hIbn3qOEoFoFjkzi/cC3qRCt9zNoaz48W9L F6BI0oEyqSVJPuX2T5m/eaKWUOVd9BSgF3nd4KTVtAA7uWTFh0OIt9SNpDRfBXFticSF AzhAtL9Z/0PT+ensJgVUA6HB2Jig83lHrhtl5RNK4HVHEiDwb+db+6/LUMsZgoay4BFn h8wPcUarmSk9isPtRsrjJcQ7fFsoFBvhqZXM8LtqHXNL7ZE+OMPnc1XPyf7iiYNDP/V5 QAZw== 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=hdLIdfFHv3QXdsm7syIIcLHy/dA4pzmBakkxNtwnQ88=; b=FAPHroPwLaYO1+R31nPIFKHnAgyJWUIVfhcegVz5wiM1+TzhCGl4x3NsQg9qniAAmL I0Q2NxNu+NkxXcHRxTmWF7K8jcfkVTQ1IpwERUYKCYKGT7qdOhLyiLPgzn9DnlT7i3w2 7U6UhPMbRSvFLSLFCqNs6lwD4ooHJ10PFwtMmsuoDxISOoy4oA9cpgPZnQ7vHV6MYyIS MXWLs9CY5z5bUE/PjJX8mx/Z9DwXOAcvt2XVQmBI2rZ711fTOwFaBD+YBum1Qltryuhb aLzCBJeMBZ6tVHmMA7yzX0jhhsKpFY+gBRTOiW+XiyhWaHHB39B/7nYutoWqVnkcIAmO lPTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=o4AQJs4E; 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 a3-20020a1709027e4300b001729badbe0fsi1190832pln.301.2022.08.18.06.27.48; Thu, 18 Aug 2022 06:27:58 -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=o4AQJs4E; 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 S244699AbiHRM4A (ORCPT + 99 others); Thu, 18 Aug 2022 08:56:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244143AbiHRMz4 (ORCPT ); Thu, 18 Aug 2022 08:55:56 -0400 Received: from mail-vk1-xa29.google.com (mail-vk1-xa29.google.com [IPv6:2607:f8b0:4864:20::a29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2048321838; Thu, 18 Aug 2022 05:55:55 -0700 (PDT) Received: by mail-vk1-xa29.google.com with SMTP id j11so715262vkk.11; Thu, 18 Aug 2022 05:55:55 -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=hdLIdfFHv3QXdsm7syIIcLHy/dA4pzmBakkxNtwnQ88=; b=o4AQJs4EQBaaxaXP2SBezP608FaT/gCyKwh720xEW0SYsAhVydbNQ+ULcm3QbmaDWq qGlstBouChh9bl8Wdu9MAfLXofhrblPQLZI8lnnMFCTJOERS/2tPGk7gjWdADDqdU0rl dGIKKEU4G5D/69S0+9GVWzTe8dJKEiAX4iQsHLp4WpzGXT8pmTbnD7QllvxZ+6XBKw6u OYS+2GVEsB5qDOwEVEGKypcfap13E1QWghJdayKM4k2EoJyqE8i46hCe5KlqMmfoxecP RnqsZRVdalrunv3Nzo8vUcMaZKeE+EnsKBHn1fP8gW6Ji9PprHdWYAbpPvrSDyK/fZO7 etIg== 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=hdLIdfFHv3QXdsm7syIIcLHy/dA4pzmBakkxNtwnQ88=; b=RQJHat+onoXbgkiqclwrU8jG5YGR8N2bRDO+MJ0JRhHUhtfB6ScJ0nubcYmP6E6Tsu zUWfM6lHnJ5uqxbT9QIXSgeeE9D11C7cXyNVBSdHP5s0mZog1MOcnppK9K1SqQ1K+CsR 3GZyx4btzHe8gLxe9WKRse2YgwFGTG3egEOCRCXCc07tStAXsZjzIhNDa84NOQ9CRfYP 8viF630jwBruZVV22lKK3Fsg61zT/6fdcwNebp3Wb7/JVbAQc1+JpcTixnCDVlIazU7g neof+KeeQ0E/1dyb2ALpg8+d3xtp9Zh20g9HK15npxwZcUsPxTSfiiflgEQFULBCyZmp zZYw== X-Gm-Message-State: ACgBeo1ZcPqchMzbmdQ4kT9UHRlTLPBQRiXt9K/SAJ8Dzdi0nn3G/vLd PA1YEBDpm19SExAhdZSCKft3SpvMWtsOV984CqK2GnXV X-Received: by 2002:a1f:2b47:0:b0:380:59c5:8b8f with SMTP id r68-20020a1f2b47000000b0038059c58b8fmr1095475vkr.20.1660827354101; Thu, 18 Aug 2022 05:55:54 -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: Thu, 18 Aug 2022 21:55:43 +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, =?UTF-8?B?7Jyg7Jqp7IiY?= 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 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: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 20= 01 > > > 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