[Intel-gfx] [PATCH i-g-t 1/2] Increase the string size for a module name
Rodrigo Siqueira
rodrigosiqueiramelo at gmail.com
Tue Aug 21 13:57:47 UTC 2018
On 08/21, Petri Latvala wrote:
> 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 at gmail.com>
> > ---
> > 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?
Hi,
To test the force option, I used two drivers: Bochs and VKMS. I noticed
that Bochs failed to load because the module name is "bochs-drm".
Additionally, if we want to add a force option, I assume that someone
can have a module name larger than four characters. Make sense? Or Did I
missed something?
Thanks for your feedback
>
> --
> Petri Latvala
--
Rodrigo Siqueira
http://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo
More information about the Intel-gfx
mailing list