Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Swati Sharma <swati2.sharma@intel.com>
To: Luca Coelho <luca@coelho.fi>, igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v2] tests/kms_plane_scaling: Fix out-of-bound array access
Date: Wed, 22 Mar 2023 15:52:18 +0530	[thread overview]
Message-ID: <17274286-8b9b-4106-ca44-c76c17fc738a@intel.com> (raw)
In-Reply-To: <4b8b5e1fd10fd32ab7f2196cb5b11129e849f3b9.camel@coelho.fi>



On 22-Mar-23 3:36 PM, Luca Coelho wrote:
> On Mon, 2023-03-20 at 20:06 +0530, Swati Sharma wrote:
>> With this fix we are solving 2 issues. Firstly, the
>> planes_scaling_combo() tests were leaving one scaler assigned
>> after running sub-test with two consecutive planes because
>> one scaler was getting reused in the next run. So with this fix
>> scaler is not reused since we won't have any common plane.
>>
>> Secondly, when k == n_planes - 1, we were trying to access
>> planes[n_planes], which led to array out of bounds error. So, with
>> this fix, this issue is fixed too.
>>
>> v2: -fix condition if n_planes is not even (JP)
>>
>> Suggested-by: Luca Coelho <luciano.coelho@intel.com>
>> Suggested-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>> Reported-by: Luca Coelho <luciano.coelho@intel.com>
>> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
>> ---
>>   tests/kms_plane_scaling.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
>> index 3a6904afb..7feb45ca3 100644
>> --- a/tests/kms_plane_scaling.c
>> +++ b/tests/kms_plane_scaling.c
>> @@ -744,7 +744,7 @@ test_planes_scaling_combo(data_t *d, int w1, int h1, int w2, int h2,
>>   		igt_assert(0);
>>   	}
>>   
>> -	for (int k = 0; k < display->pipes[pipe].n_planes; k++) {
>> +	for (int k = 0; k < display->pipes[pipe].n_planes - 1; k += 2) {
>>   		igt_plane_t *p1, *p2;
>>   
>>   		p1 = &display->pipes[pipe].planes[k];
> 
> What will happen if we have only 1 plane? Shouldn't the test be
> skipped? It seems that the loop will just not run and the test result
> will be pass?
Right.
Should we add igt_require(n_planes >=2)?
With that if n_planes=1 test will SKIP.
> 
> --
> Cheers,
> Luca.

-- 
~Swati Sharma

  reply	other threads:[~2023-03-22 10:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 14:36 [igt-dev] [PATCH i-g-t v2] tests/kms_plane_scaling: Fix out-of-bound array access Swati Sharma
2023-03-20 15:13 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_plane_scaling: Fix out-of-bound array access (rev5) Patchwork
2023-03-20 18:19 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-03-21  6:59 ` [igt-dev] [PATCH i-g-t v2] tests/kms_plane_scaling: Fix out-of-bound array access Juha-Pekka Heikkila
2023-03-22 10:06 ` Luca Coelho
2023-03-22 10:22   ` Swati Sharma [this message]
2023-03-22 10:44     ` Luca Coelho

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=17274286-8b9b-4106-ca44-c76c17fc738a@intel.com \
    --to=swati2.sharma@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=luca@coelho.fi \
    /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