[Mesa-dev] [PATCH 1/2] intel: fix memmem() warning first arg shouldn't be NULL

Timothy Arceri tarceri at itsqueeze.com
Mon Oct 23 01:26:11 UTC 2017


---
 src/intel/compiler/brw_eu_validate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/intel/compiler/brw_eu_validate.c b/src/intel/compiler/brw_eu_validate.c
index 9f72c650ddb..07318b9d3c0 100644
--- a/src/intel/compiler/brw_eu_validate.c
+++ b/src/intel/compiler/brw_eu_validate.c
@@ -47,6 +47,9 @@ cat(struct string *dest, const struct string src)
 static bool
 contains(const struct string haystack, const struct string needle)
 {
+   if (!haystack.str)
+      return false;
+
    return memmem(haystack.str, haystack.len, needle.str, needle.len) != NULL;
 }
 #define CONTAINS(haystack, needle) \
-- 
2.13.6



More information about the mesa-dev mailing list