From: "Roy Spliet" <rspliet@eclipso.eu>
To: Kees Cook <keescook@google.com>
Cc: bskeggs@redhat.com, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: nouveau nvaa clock missing break?
Date: Fri, 27 Dec 2013 11:05:26 +0100 [thread overview]
Message-ID: <8191a78f885837fe5c89d9ffb6dd251a@mail.eclipso.de> (raw)
In-Reply-To: <CAGXu5j+mBiXj2+iPKGU+Ffb3oXqL+cH8JULH_hoORJNiQgQQFQ@mail.gmail.com>
Hello Kees,
Thanks for your feedback. Let me first reassure you that this fall-through is indeed intentional: vdiv should be set regardless of the clock source. A comment line would definitely be in place though for future nouveau hackers.
In read_pll, post_div can never be zero in valid execution. If the register-read returns zero, the GPU has either fallen off the bus, or crashed because someone set a divider of 0. I agree that this is not very robust and will probably lead to a divide-by-zero on hardware failure. Checking it doesn't harm I bet!
I will propose a patch addressing these issues as soon as I find some free time. Thanks again for the feedback. Yours,
Roy
--- Ursprüngliche Nachricht ---
Von: Kees Cook <keescook@google.com>
Datum: 20:51:22 26-12-2013
An: Roy Spliet <rspliet@eclipso.eu>
Betreff: nouveau nvaa clock missing break?
> Hi,
>
> Just curious if this code is missing a "break" or not...
>
> /drivers/gpu/drm/nouveau/core/subdev/clock/nvaa.c: 373 in nvaa_clock_prog()
>
>
> switch (priv->vsrc) {
> case nv_clk_src_cclk:
> mast |= 0x00400000;
> default:
> nv_wr32(clk, 0x4600, priv->vdiv);
> }
>
> Coverity noticed it as CID 1135671. If it's intentional, it might be
> nice to add a "fall through" comment there.
>
> Coverity also complained about read_pll (CID 1135670) where post_div
> could (unlikely) be 0 and used for a divide-by-zero.
>
> Thanks!
>
> -Kees
>
> --
> Kees Cook
> Chrome OS Security
>
prev parent reply other threads:[~2013-12-27 10:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-26 19:51 nouveau nvaa clock missing break? Kees Cook
2013-12-27 10:05 ` Roy Spliet [this message]
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=8191a78f885837fe5c89d9ffb6dd251a@mail.eclipso.de \
--to=rspliet@eclipso.eu \
--cc=bskeggs@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=keescook@google.com \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).