Re: [Mesa-dev] [PATCH shaderdb 1/3] intel_stub: override pci-id only if INTEL_DEVID_OVERRIDE is set

2018-02-12 Thread Kenneth Graunke
On Monday, February 12, 2018 5:26:14 PM PST Dongwon Kim wrote:
> To prevent a segfault, pci-id is set only if INTEL_DEVID_OVERRIDE exists.
> 
> Signed-off-by: Dongwon Kim 
> ---
>  intel_stub.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/intel_stub.c b/intel_stub.c
> index ea88400..cf9ddff 100644
> --- a/intel_stub.c
> +++ b/intel_stub.c
> @@ -28,6 +28,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -174,6 +175,7 @@ ioctl(int fd, unsigned long request, ...)
>   va_list args;
>   void *argp;
>   struct stat buf;
> + char *pci_id;
>  
>   va_start(args, request);
>   argp = va_arg(args, void *);
> @@ -199,7 +201,13 @@ ioctl(int fd, unsigned long request, ...)
>  *getparam->value = 1;
>  break;
>  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;
>  case I915_PARAM_CMD_PARSER_VERSION:
>  *getparam->value = 9;
> 

This patch is:

Reviewed-by: Kenneth Graunke 


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH shaderdb 1/3] intel_stub: override pci-id only if INTEL_DEVID_OVERRIDE is set

2018-02-12 Thread Dongwon Kim
To prevent a segfault, pci-id is set only if INTEL_DEVID_OVERRIDE exists.

Signed-off-by: Dongwon Kim 
---
 intel_stub.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/intel_stub.c b/intel_stub.c
index ea88400..cf9ddff 100644
--- a/intel_stub.c
+++ b/intel_stub.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -174,6 +175,7 @@ ioctl(int fd, unsigned long request, ...)
va_list args;
void *argp;
struct stat buf;
+   char *pci_id;
 
va_start(args, request);
argp = va_arg(args, void *);
@@ -199,7 +201,13 @@ ioctl(int fd, unsigned long request, ...)
 *getparam->value = 1;
 break;
 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;
 case I915_PARAM_CMD_PARSER_VERSION:
 *getparam->value = 9;
-- 
2.16.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev