[igt-dev] [PATCH i-g-t 21/21] lib/drmtest: Don't read from NULL in set_forced_driver

Rodrigo Siqueira rodrigosiqueiramelo at gmail.com
Wed Jan 16 12:15:41 UTC 2019


On 01/16, Petri Latvala wrote:
> The only caller so far never passes NULL so no effects today.
> 
> Signed-off-by: Petri Latvala <petri.latvala at intel.com>
> Cc: Rodrigo Siqueira <rodrigosiqueiramelo at gmail.com>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
>  lib/drmtest.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 7c124ac6..1964795a 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -134,8 +134,10 @@ static char _forced_driver[16] = "";
>   */
>  void __set_forced_driver(const char *name)
>  {
> -	if (!name)
> +	if (!name) {
>  		igt_warn("No driver specified, keep default behaviour\n");
> +		return;
> +	}
>  
>  	strncpy(_forced_driver, name, sizeof(_forced_driver) - 1);
>  }
> -- 
> 2.19.1
> 

Hi,

I tried to apply the patch, and it does not applied directly (I updated
my master before test). I got the following error:

 error: patch failed: lib/drmtest.c:134
 error: lib/drmtest.c: patch does not apply

Anyway, for me, everything is fine with the changes. Additionally, I
tested the patch with:

 Commands:

 IGT_FORCE_DRIVER=vkms ./tests/kms_flip  --run-subtest basic-flip-vs-wf_vblank
 IGT_FORCE_DRIVER= ./tests/kms_flip  --run-subtest basic-flip-vs-wf_vblank
 ./tests/kms_flip  --run-subtest basic-flip-vs-wf_vblank

 Environment:

 -> Qemu VM with Arch linux
 -> GPUs drivers: Bosch (card0) and vkms (card1)
 -> Kernel - 5.0.0-rc1

Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo at gmail.com>

-- 
Rodrigo Siqueira
https://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo


More information about the igt-dev mailing list