Re: [PATCH i-g-t 1/2] Increase the string size for a module name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 07, 2018 at 08:24:39PM -0300, Rodrigo Siqueira wrote:
> Some modules name are larger than 5 characters, this can be a problem to
> add support for other modules. This patch, increase the maximum size in
> order to enable other modules to use IGT.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@xxxxxxxxx>
> ---
>  lib/drmtest.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index fae6f86f..eee733eb 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -60,6 +60,8 @@
>  #include "ioctl_wrappers.h"
>  #include "igt_dummyload.h"
>  
> +#define NAME_LEN 32
> +
>  /**
>   * SECTION:drmtest
>   * @short_description: Base library for drm tests and tools
> @@ -82,7 +84,7 @@ static int __get_drm_device_name(int fd, char *name)
>  	drm_version_t version;
>  
>  	memset(&version, 0, sizeof(version));
> -	version.name_len = 4;
> +	version.name_len = NAME_LEN;
>  	version.name = name;
>  
>  	if (!drmIoctl(fd, DRM_IOCTL_VERSION, &version)){
> @@ -94,7 +96,7 @@ static int __get_drm_device_name(int fd, char *name)
>  
>  static bool __is_device(int fd, const char *expect)
>  {
> -	char name[5] = "";
> +	char name[NAME_LEN] = "";

This would need to be NAME_LEN + 1 to have room for the
null-termination.

But, is this patch really necessary? Are there false matches from
using a substring of 4 to match driver names?



-- 
Petri Latvala
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux