diff mbox series

drm/tests: Fix incorrect argument in drm_test_mm_insert_range

Message ID 20230911130323.7037-2-janusz.krzysztofik@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/tests: Fix incorrect argument in drm_test_mm_insert_range | expand

Commit Message

Janusz Krzysztofik Sept. 11, 2023, 1:03 p.m. UTC
While drm_mm test was converted form igt selftest to kunit, unexpected
value of "end" argument equal "start" was introduced to one of calls to a
function that executes the drm_test_mm_insert_range for specific start/end
pair of arguments.  As a consequence, DRM_MM_BUG_ON(end <= start) is
triggered.  Fix it by restoring the original value.

Fixes: fc8d29e298cf ("drm: selftest: convert drm_mm selftest to KUnit")
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Cc: "Maíra Canal" <mairacanal@riseup.net>
Cc: Arthur Grillo <arthurgrillo@riseup.net>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Daniel Latypov <dlatypov@google.com>
Cc: stable@vger.kernel.org # v6.1+
---
 drivers/gpu/drm/tests/drm_mm_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Maíra Canal Sept. 15, 2023, 2:01 p.m. UTC | #1
Hi,

On 9/11/23 10:03, Janusz Krzysztofik wrote:
> While drm_mm test was converted form igt selftest to kunit, unexpected
> value of "end" argument equal "start" was introduced to one of calls to a
> function that executes the drm_test_mm_insert_range for specific start/end
> pair of arguments.  As a consequence, DRM_MM_BUG_ON(end <= start) is
> triggered.  Fix it by restoring the original value.
> 
> Fixes: fc8d29e298cf ("drm: selftest: convert drm_mm selftest to KUnit")
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>

Reviewed-by: Maíra Canal <mairacanal@riseup.net>

Do you need me to push it to drm-misc-fixes?

Best Regards,
- Maíra

> Cc: "Maíra Canal" <mairacanal@riseup.net>
> Cc: Arthur Grillo <arthurgrillo@riseup.net>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Cc: Daniel Latypov <dlatypov@google.com>
> Cc: stable@vger.kernel.org # v6.1+
> ---
>   drivers/gpu/drm/tests/drm_mm_test.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/tests/drm_mm_test.c b/drivers/gpu/drm/tests/drm_mm_test.c
> index 186b28dc70380..05d5e7af6d250 100644
> --- a/drivers/gpu/drm/tests/drm_mm_test.c
> +++ b/drivers/gpu/drm/tests/drm_mm_test.c
> @@ -939,7 +939,7 @@ static void drm_test_mm_insert_range(struct kunit *test)
>   		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size, 0, max - 1));
>   		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size, 0, max / 2));
>   		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size,
> -								    max / 2, max / 2));
> +								    max / 2, max));
>   		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size,
>   								    max / 4 + 1, 3 * max / 4 - 1));
>
Janusz Krzysztofik Sept. 15, 2023, 2:17 p.m. UTC | #2
Hi Maíra,

Thanks for review.

On Friday, 15 September 2023 16:01:31 CEST Maira Canal wrote:
> Hi,
> 
> On 9/11/23 10:03, Janusz Krzysztofik wrote:
> > While drm_mm test was converted form igt selftest to kunit, unexpected
> > value of "end" argument equal "start" was introduced to one of calls to a
> > function that executes the drm_test_mm_insert_range for specific start/end
> > pair of arguments.  As a consequence, DRM_MM_BUG_ON(end <= start) is
> > triggered.  Fix it by restoring the original value.
> > 
> > Fixes: fc8d29e298cf ("drm: selftest: convert drm_mm selftest to KUnit")
> > Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
> 
> Reviewed-by: Maíra Canal <mairacanal@riseup.net>
> 
> Do you need me to push it to drm-misc-fixes?

Yes, please do if you can.

Thanks,
Janusz

> 
> Best Regards,
> - Maíra
> 
> > Cc: "Maíra Canal" <mairacanal@riseup.net>
> > Cc: Arthur Grillo <arthurgrillo@riseup.net>
> > Cc: Javier Martinez Canillas <javierm@redhat.com>
> > Cc: Daniel Latypov <dlatypov@google.com>
> > Cc: stable@vger.kernel.org # v6.1+
> > ---
> >   drivers/gpu/drm/tests/drm_mm_test.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/tests/drm_mm_test.c b/drivers/gpu/drm/tests/drm_mm_test.c
> > index 186b28dc70380..05d5e7af6d250 100644
> > --- a/drivers/gpu/drm/tests/drm_mm_test.c
> > +++ b/drivers/gpu/drm/tests/drm_mm_test.c
> > @@ -939,7 +939,7 @@ static void drm_test_mm_insert_range(struct kunit *test)
> >   		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size, 0, max - 1));
> >   		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size, 0, max / 2));
> >   		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size,
> > -								    max / 2, max / 2));
> > +								    max / 2, max));
> >   		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size,
> >   								    max / 4 + 1, 3 * max / 4 - 1));
> >   
>
Maíra Canal Sept. 15, 2023, 2:44 p.m. UTC | #3
On 9/15/23 11:17, Janusz Krzysztofik wrote:
> Hi Maíra,
> 
> Thanks for review.
> 
> On Friday, 15 September 2023 16:01:31 CEST Maira Canal wrote:
>> Hi,
>>
>> On 9/11/23 10:03, Janusz Krzysztofik wrote:
>>> While drm_mm test was converted form igt selftest to kunit, unexpected
>>> value of "end" argument equal "start" was introduced to one of calls to a
>>> function that executes the drm_test_mm_insert_range for specific start/end
>>> pair of arguments.  As a consequence, DRM_MM_BUG_ON(end <= start) is
>>> triggered.  Fix it by restoring the original value.
>>>
>>> Fixes: fc8d29e298cf ("drm: selftest: convert drm_mm selftest to KUnit")
>>> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
>>
>> Reviewed-by: Maíra Canal <mairacanal@riseup.net>
>>
>> Do you need me to push it to drm-misc-fixes?
> 
> Yes, please do if you can.

Pushed to drm-misc/drm-misc-fixes. Thanks!

Best Regards,
- Maíra

> 
> Thanks,
> Janusz
> 
>>
>> Best Regards,
>> - Maíra
>>
>>> Cc: "Maíra Canal" <mairacanal@riseup.net>
>>> Cc: Arthur Grillo <arthurgrillo@riseup.net>
>>> Cc: Javier Martinez Canillas <javierm@redhat.com>
>>> Cc: Daniel Latypov <dlatypov@google.com>
>>> Cc: stable@vger.kernel.org # v6.1+
>>> ---
>>>    drivers/gpu/drm/tests/drm_mm_test.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/tests/drm_mm_test.c b/drivers/gpu/drm/tests/drm_mm_test.c
>>> index 186b28dc70380..05d5e7af6d250 100644
>>> --- a/drivers/gpu/drm/tests/drm_mm_test.c
>>> +++ b/drivers/gpu/drm/tests/drm_mm_test.c
>>> @@ -939,7 +939,7 @@ static void drm_test_mm_insert_range(struct kunit *test)
>>>    		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size, 0, max - 1));
>>>    		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size, 0, max / 2));
>>>    		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size,
>>> -								    max / 2, max / 2));
>>> +								    max / 2, max));
>>>    		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size,
>>>    								    max / 4 + 1, 3 * max / 4 - 1));
>>>    
>>
> 
> 
> 
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tests/drm_mm_test.c b/drivers/gpu/drm/tests/drm_mm_test.c
index 186b28dc70380..05d5e7af6d250 100644
--- a/drivers/gpu/drm/tests/drm_mm_test.c
+++ b/drivers/gpu/drm/tests/drm_mm_test.c
@@ -939,7 +939,7 @@  static void drm_test_mm_insert_range(struct kunit *test)
 		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size, 0, max - 1));
 		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size, 0, max / 2));
 		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size,
-								    max / 2, max / 2));
+								    max / 2, max));
 		KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size,
 								    max / 4 + 1, 3 * max / 4 - 1));