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

Petri Latvala
2019-01-16T11:21:04Z

The only caller so far never passes NULL so no effects today.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Daniel Vetter <daniel.vetter@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