From f5c48c6759e566f95ce02851f1acbb560ff68c14 Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 20 Mar 2019 15:34:56 -0400 Subject: [PATCH] P4 to Git Change 1759096 by todli@todli-win-opencl-kv1 on 2019/03/20 15:07:10 SWDEV-165960 - Add check for duplicate vendors of different libraries using vendor suffix after vendor info is loaded from library Affected files ... ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/icd/icd.c#11 edit [ROCm/clr commit: 21ecd9c93ad18e12b6a1d9a9f783425c38c13a74] --- .../clr/opencl/api/opencl/khronos/icd/icd.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/projects/clr/opencl/api/opencl/khronos/icd/icd.c b/projects/clr/opencl/api/opencl/khronos/icd/icd.c index fdeff798fc..fbb3120363 100644 --- a/projects/clr/opencl/api/opencl/khronos/icd/icd.c +++ b/projects/clr/opencl/api/opencl/khronos/icd/icd.c @@ -187,12 +187,23 @@ void khrIcdVendorAdd(const char *libraryName) // add this vendor to the list of vendors at the tail { KHRicdVendor **prevNextPointer = NULL; - for (prevNextPointer = &khrIcdVendors; *prevNextPointer; prevNextPointer = &( (*prevNextPointer)->next) ); - *prevNextPointer = vendor; + for (prevNextPointer = &khrIcdVendors; *prevNextPointer; prevNextPointer = &( (*prevNextPointer)->next) ) + { + if (!strcmp(vendor->suffix, (*prevNextPointer)->suffix)) { + free(suffix); + free(vendor); + vendor = NULL; + KHR_ICD_TRACE("already loaded vendor with suffix %s, nothing to do here\n", suffix); + break; + } + } + if (vendor) + { + *prevNextPointer = vendor; + KHR_ICD_TRACE("successfully added vendor %s with suffix %s\n", libraryName, suffix); + } } - KHR_ICD_TRACE("successfully added vendor %s with suffix %s\n", libraryName, suffix); - } Done: