public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: "moderated list:INTEL ASoC DRIVERS" <alsa-devel@alsa-project.org>,
	"Jie Yang" <yang.jie@linux.intel.com>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Liam Girdwood" <liam.r.girdwood@linux.intel.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
Subject: Re: [PATCH] ASoC: Intel: Skylake: Fix available clock counter incrementation
Date: Mon, 24 Feb 2020 11:53:22 -0600	[thread overview]
Message-ID: <05b9148c-0bd5-be93-5363-9fdff67febbe@linux.intel.com> (raw)
In-Reply-To: <dd5cdb01-eaac-7536-e587-3caf13132e9b@intel.com>



On 2/24/20 11:42 AM, Cezary Rojewski wrote:
> On 2020-02-24 17:18, Pierre-Louis Bossart wrote:
>> On 2/24/20 6:52 AM, Amadeusz Sławiński wrote:
>>> Incrementation of avail_clk_cnt was incorrectly moved to error path. Put
>>> it back to success path.
>>>
> 
>>> diff --git a/sound/soc/intel/skylake/skl-ssp-clk.c 
>>> b/sound/soc/intel/skylake/skl-ssp-clk.c
>>> index 1c0e5226cb5b..bd43885f3805 100644
>>> --- a/sound/soc/intel/skylake/skl-ssp-clk.c
>>> +++ b/sound/soc/intel/skylake/skl-ssp-clk.c
>>> @@ -384,9 +384,11 @@ static int skl_clk_dev_probe(struct 
>>> platform_device *pdev)
>>>                   &clks[i], clk_pdata, i);
>>>           if (IS_ERR(data->clk[data->avail_clk_cnt])) {
>>> -            ret = PTR_ERR(data->clk[data->avail_clk_cnt++]);
>>> +            ret = PTR_ERR(data->clk[data->avail_clk_cnt]);
>>
>> Are you sure?
>>
>> If you start with avail_clk_cnt set to zero, the error handling will 
>> decrement and access offset -1
>>
>> static void unregister_src_clk(struct skl_clk_data *dclk)
>> {
>>       while (dclk->avail_clk_cnt--)
>>           clkdev_drop(dclk->clk[dclk->avail_clk_cnt]->lookup); <<< oob 
>> access with offset -1
>> }
>>
> 
> Decrementation will occur after while's check evaluation - loop will 
> exit, decrementation happens regardless.

ok, I need more coffee I guess :-)

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

  reply	other threads:[~2020-02-24 17:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24 12:52 [PATCH] ASoC: Intel: Skylake: Fix available clock counter incrementation Amadeusz Sławiński
2020-02-24 12:27 ` Cezary Rojewski
2020-02-24 16:18 ` Pierre-Louis Bossart
2020-02-24 17:37   ` Amadeusz Sławiński
2020-02-24 17:42   ` Cezary Rojewski
2020-02-24 17:53     ` Pierre-Louis Bossart [this message]
2020-02-24 22:22 ` Applied "ASoC: Intel: Skylake: Fix available clock counter incrementation" to the asoc tree Mark Brown

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=05b9148c-0bd5-be93-5363-9fdff67febbe@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=tiwai@suse.com \
    --cc=yang.jie@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox