From: Mathieu Larouche <mathieu.larouche@matrox.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: drm/mgag200: don't use uninitialized variables in mga_g200se_set_plls()
Date: Tue, 20 Oct 2015 11:12:06 -0400 [thread overview]
Message-ID: <562659C6.4050204@matrox.com> (raw)
In-Reply-To: <5626733102000078000ACF6F@prv-mh.provo.novell.com>
On 20/10/2015 11:00 AM, Jan Beulich wrote:
>>>> On 20.10.15 at 16:47, <mathieu.larouche@matrox.com> wrote:
>> On 19/10/2015 6:29 AM, Jan Beulich wrote:
>>> --- 4.3-rc6/drivers/gpu/drm/mgag200/mgag200_mode.c
>>> +++ 4.3-rc6-mgag200-uninit/drivers/gpu/drm/mgag200/mgag200_mode.c
>>> @@ -194,7 +194,7 @@ static int mga_g200se_set_plls(struct mg
>>> }
>>> }
>>>
>>> - fvv = pllreffreq * testn / testm;
>>> + fvv = pllreffreq * n / m;
>>> fvv = (fvv - 800000) / 50000;
>>>
>>> if (fvv > 15)
>>>
>> If you are using n/m instead of testn/testm, you need to
>> add 1 to the variables to keep consistency. However, you
>> have the same issue where m/n could be used without being
>> initialized. So, I propose to keep testm, testn & testp
>> and initialized them with the default value.
> That makes them initialized, but since testn and testm are used
> as loop variables I don't see how initializing them to default
> values helps overcome the other half of the problem described
> (them having a constant, pre-determined value at the end of
> the loops: testn=257, testm=33). As to testp - it is always
> initialized anyway (so long as P_ARRAY_SIZE is not zero). And
> in the if() branch initialization isn't needed either, since the
> variables aren't being used after the loops.
>
> Jan
>
>
Sorry, I missed that part in your initial comment and you are right,
there's an issue there. So, your proposed patch totally make sense,
you only need to add 1 to m/n.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-10-20 15:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-19 10:29 drm/mgag200: don't use uninitialized variables in mga_g200se_set_plls() Jan Beulich
2015-10-20 14:47 ` Mathieu Larouche
2015-10-20 15:00 ` Jan Beulich
2015-10-20 15:12 ` Mathieu Larouche [this message]
2015-10-20 15:55 ` [PATCH v2] " Jan Beulich
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=562659C6.4050204@matrox.com \
--to=mathieu.larouche@matrox.com \
--cc=JBeulich@suse.com \
--cc=dri-devel@lists.freedesktop.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