From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Kees Cook <kees@kernel.org>
Cc: Philipp Stanner <pstanner@redhat.com>,
Hans Verkuil <hverkuil@xs4all.nl>, Kevin Hao <haokexin@gmail.com>,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH v2 04/13] media: dvb_frontend: don't play tricks with underflow values
Date: Sat, 19 Oct 2024 08:39:13 +0200 [thread overview]
Message-ID: <20241019083913.5fb953ac@foz.lan> (raw)
In-Reply-To: <4D0C7D12-C645-4766-B7B1-0B34B2129579@kernel.org>
Em Fri, 18 Oct 2024 07:37:52 -0700
Kees Cook <kees@kernel.org> escreveu:
> On October 18, 2024 4:44:20 AM PDT, Philipp Stanner <pstanner@redhat.com> wrote:
> >On Fri, 2024-10-18 at 07:53 +0200, Mauro Carvalho Chehab wrote:
> >> fepriv->auto_sub_step is unsigned. Setting it to -1 is just a
> >> trick to avoid calling continue, as reported by Coverity.
> >>
> >> It relies to have this code just afterwards:
> >>
> >> if (!ready) fepriv->auto_sub_step++;
> >>
> >> Simplify the code by simply setting it to zero and use
> >> continue to return to the while loop.
> >>
> >> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> >
> >Oh wow, back to the big-bang-commit ^^'
> >
> >So is this a bug or not? It seems to me that the uint underflows to
> >UINT_MAX, and then wrapps around to 0 again through the ++..
> >
> >I take the liberty of ++CCing Kees, since I heard him talk a lot about
> >overflowing on Plumbers.
> >
> >If it's not a bug, I would not use "Fixes". If it is a bug, it should
> >be backported to stable, agreed?
There is a long thread about Fixes: tag at ksummit ML.
https://lore.kernel.org/all/20240714192914.1e1d3448@gandalf.local.home/T/
My conclusions for it is that:
1. Fixes: != Cc: stable.
This is even somewhat stated at
Documentation/process/stable-kernel-rules.rst when it defines additional
rules for Cc: stable;
2. As result of (1), all Cc: stable need fixes, but not all fixes: need
a Cc: stable. Btw, I double-checked it with a -stable maintainer
(Greg);
3. It seems that most of people at ksummit discussion (including me)
use Fixes: when the patch is not doing an improvement.
> >Plus, is there a report-link somewhere by Coverty that could be linked
> >with "Closes: "?
Coverity issues are not publicly visible (and IMO it shouldn't).
We should not add closes: to something that only the ones with access
to it may see.
> Yeah, this is "avoid currently harmless overflow" fix. It is just avoiding depending on the wrapping behavior, which is an improvement but not really a "bug fix"; more a code style that will keep future work of making the kernel wrapping-safe.
It is a fix in the sense that it solves an issue reported by Coverity.
> >> if (!ready) fepriv->auto_sub_step++;
> >
>
> But this change seems incomplete. The above line is no longer needed.
Yes, this is now a dead code.
> And I actually think this could be refractored to avoid needing "ready" at all?
Yeah, it sounds a good idea to place the zig-zag drift calculus on a
separate function, doing some cleanups in the process.
I'll add it to my todo list.
Thanks,
Mauro
next prev parent reply other threads:[~2024-10-19 6:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 5:53 [PATCH v2 00/13] Media: fix several issues on drivers Mauro Carvalho Chehab
2024-10-18 5:53 ` [PATCH v2 01/13] media: v4l2-ctrls-api: fix error handling for v4l2_g_ctrl() Mauro Carvalho Chehab
2024-10-18 6:13 ` Hans Verkuil
2024-10-18 6:26 ` Mauro Carvalho Chehab
2024-10-21 18:32 ` Dan Carpenter
2024-10-18 5:53 ` [PATCH v2 02/13] media: v4l2-tpg: prevent the risk of a division by zero Mauro Carvalho Chehab
2024-10-18 5:53 ` [PATCH v2 03/13] media: dvbdev: prevent the risk of out of memory access Mauro Carvalho Chehab
2024-10-18 5:53 ` [PATCH v2 04/13] media: dvb_frontend: don't play tricks with underflow values Mauro Carvalho Chehab
2024-10-18 11:44 ` Philipp Stanner
2024-10-18 14:37 ` Kees Cook
2024-10-18 16:02 ` Philipp Stanner
2024-10-19 6:39 ` Mauro Carvalho Chehab [this message]
2024-10-18 5:53 ` [PATCH v2 05/13] media: mgb4: protect driver against spectre Mauro Carvalho Chehab
2024-10-18 5:53 ` [PATCH v2 06/13] media: av7110: fix a spectre vulnerability Mauro Carvalho Chehab
2024-10-18 5:53 ` [PATCH v2 07/13] media: s5p-jpeg: prevent buffer overflows Mauro Carvalho Chehab
2024-10-18 5:53 ` [PATCH v2 08/13] media: ar0521: don't overflow when checking PLL values Mauro Carvalho Chehab
2024-10-18 9:53 ` Krzysztof Hałasa
2024-10-18 5:53 ` [PATCH v2 09/13] media: cx24116: prevent overflows on SNR calculus Mauro Carvalho Chehab
2024-10-18 5:53 ` [PATCH v2 10/13] media: adv7604: prevent underflow condition when reporting colorspace Mauro Carvalho Chehab
2024-10-18 5:53 ` [PATCH v2 11/13] media: stb0899_algo: initialize cfr before using it Mauro Carvalho Chehab
2024-10-18 5:53 ` [PATCH v2 12/13] media: cec: extron-da-hd-4k-plus: don't use -1 as an error code Mauro Carvalho Chehab
2024-10-18 5:53 ` [PATCH v2 13/13] media: pulse8-cec: fix data timestamp at pulse8_setup() Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241019083913.5fb953ac@foz.lan \
--to=mchehab+huawei@kernel.org \
--cc=haokexin@gmail.com \
--cc=hverkuil@xs4all.nl \
--cc=kees@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=pstanner@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.