[Intel-gfx] [igt-dev] [PATCH i-g-t 1/2] Increase the string size for a module name
Petri Latvala
petri.latvala at intel.com
Wed Aug 22 08:12:39 UTC 2018
On Tue, Aug 21, 2018 at 10:57:47AM -0300, Rodrigo Siqueira wrote:
> 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".
Driver name is still not the same as the kernel module name necessarily.
> 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?
Sure, names can and are already larger than four characters
(e.g. "amdgpu"). But the driver matching uses the first four
characters of the name. The length of matching the driver name doesn't
need to be lengthened as of yet.
Kernel module name, again, is another thing entirely.
--
Petri Latvala
More information about the Intel-gfx
mailing list