From: Neil Armstrong <neil.armstrong@linaro.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
Stephen Boyd <sboyd@kernel.org>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] OPP: add index check to assert to avoid buffer overflow in _read_freq()
Date: Fri, 29 Nov 2024 10:07:48 +0100 [thread overview]
Message-ID: <b8de4e95-d598-49dc-83aa-a9ffc2714a24@linaro.org> (raw)
In-Reply-To: <20241129090457.4ibsyulffydnc3ns@vireshk-i7>
On 29/11/2024 10:04, Viresh Kumar wrote:
> On 29-11-24, 09:53, Neil Armstrong wrote:
>> Hi,
>>
>> On 29/11/2024 09:40, Viresh Kumar wrote:
>>> On 28-11-24, 11:07, Neil Armstrong wrote:
>>>> Pass the freq index to the assert function to make sure
>>>> we do not read a freq out of the opp->rates[] table.
>>>>
>>>> Without that the index value is never checked when called from
>>>> dev_pm_opp_find_freq_exact_indexed() or
>>>> dev_pm_opp_find_freq_ceil/floor_indexed().
>>>
>>> These APIs aren't supported for cases where we have more than one clks
>>> available and hence assert for single clk.
>>>
>>
>> I don't understand, the _indexed functions clearly have an index parameter
>> which is documented as "Clock index"
>
> Ahh, I missed that there are few _indexed() helpers as well which you are
> correctly modifying.
>
>> I agree we could leave the other ones with assert_single_clk, but we would
>> need to duplicate it to have one with the index parameter, so it felt simpler
>> to use assert_clk_index everywhere but indeed we do not exclude them for
>> when there's multiple clock...
>
> What prevents a user to call dev_pm_opp_find_freq_exact() for a multi-clk setup
> after your patch ? As we use Index = 0 here in the code.
>
> That's why I would prefer the earlier assert for all these, except the indexed
> ones.
Yes, let me send a v2 with this addressed
Thanks,
Neil
next prev parent reply other threads:[~2024-11-29 9:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-28 10:07 [PATCH 0/2] OPP: fix buffer overflow in indexed freq and bandwidth reads Neil Armstrong
2024-11-28 10:07 ` [PATCH 1/2] OPP: add index check to assert to avoid buffer overflow in _read_freq() Neil Armstrong
2024-11-29 8:40 ` Viresh Kumar
2024-11-29 8:53 ` Neil Armstrong
2024-11-29 9:04 ` Viresh Kumar
2024-11-29 9:07 ` Neil Armstrong [this message]
2024-11-28 10:07 ` [PATCH 2/2] OPP: fix dev_pm_opp_find_bw_*() when bandwidth table not initialized Neil Armstrong
2024-11-29 8:41 ` Viresh Kumar
2024-11-29 9:34 ` Neil Armstrong
2024-11-29 9:39 ` Viresh Kumar
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=b8de4e95-d598-49dc-83aa-a9ffc2714a24@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=nm@ti.com \
--cc=sboyd@kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=vireshk@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
all inboxes | Powered by JetHome®