Commit 7f89b785 authored by Dongwon Kim's avatar Dongwon Kim Committed by Kenneth Graunke

intel_stub: override pci-id only if INTEL_DEVID_OVERRIDE is set

To prevent a segfault, pci-id is set only if INTEL_DEVID_OVERRIDE exists.
Signed-off-by: default avatarDongwon Kim <dongwon.kim@intel.com>
Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
parent dc8ef627
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <stdarg.h> #include <stdarg.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
...@@ -174,6 +175,7 @@ ioctl(int fd, unsigned long request, ...) ...@@ -174,6 +175,7 @@ ioctl(int fd, unsigned long request, ...)
va_list args; va_list args;
void *argp; void *argp;
struct stat buf; struct stat buf;
char *pci_id;
va_start(args, request); va_start(args, request);
argp = va_arg(args, void *); argp = va_arg(args, void *);
...@@ -199,7 +201,13 @@ ioctl(int fd, unsigned long request, ...) ...@@ -199,7 +201,13 @@ ioctl(int fd, unsigned long request, ...)
*getparam->value = 1; *getparam->value = 1;
break; break;
case I915_PARAM_CHIPSET_ID: case I915_PARAM_CHIPSET_ID:
*getparam->value = strtod(getenv("INTEL_DEVID_OVERRIDE"), NULL); pci_id = getenv("INTEL_DEVID_OVERRIDE");
if (pci_id)
*getparam->value = strtod(pci_id, NULL);
else
return -EINVAL;
break; break;
case I915_PARAM_CMD_PARSER_VERSION: case I915_PARAM_CMD_PARSER_VERSION:
*getparam->value = 9; *getparam->value = 9;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment