From 60bb1f5540801280cf925c2cc77f23ba6145c570 Mon Sep 17 00:00:00 2001 From: nia Date: Thu, 10 Jun 2021 11:18:06 +0000 Subject: pocl: Fix a null pointer dererence if sysfs is not present *sigh* --- parallel/pocl/Makefile | 4 ++-- parallel/pocl/distinfo | 3 ++- .../pocl/patches/patch-lib_CL_devices_cpuinfo.c | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 parallel/pocl/patches/patch-lib_CL_devices_cpuinfo.c (limited to 'parallel') diff --git a/parallel/pocl/Makefile b/parallel/pocl/Makefile index a8c4f6d8956..738f3f8141f 100644 --- a/parallel/pocl/Makefile +++ b/parallel/pocl/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.2 2021/06/10 10:26:32 nia Exp $ +# $NetBSD: Makefile,v 1.3 2021/06/10 11:18:06 nia Exp $ DISTNAME= pocl-1.7 -PKGREVISION= 1 +PKGREVISION= 2 CATEGORIES= parallel MASTER_SITES= http://portablecl.org/downloads/ diff --git a/parallel/pocl/distinfo b/parallel/pocl/distinfo index d8083b7d587..04fb3eff544 100644 --- a/parallel/pocl/distinfo +++ b/parallel/pocl/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.1 2021/06/10 09:57:40 nia Exp $ +$NetBSD: distinfo,v 1.2 2021/06/10 11:18:06 nia Exp $ SHA1 (pocl-1.7.tar.gz) = 7f28546ac51d89ba699cc5adce1ddf2e91bdf230 RMD160 (pocl-1.7.tar.gz) = 75555c802bf133298d615f5c146174dc0f959a72 @@ -8,6 +8,7 @@ SHA1 (patch-CMakeLists.txt) = 314c492b03d66ab373cc59c926fe3d27aeb3a5a3 SHA1 (patch-config.h.in.cmake) = 974fad1f19516ef0b73f7db5b3948e677f4aaf98 SHA1 (patch-lib_CL_devices_basic_basic.c) = 9110d868a305cefc2e19fd7d7482f6ce2b8a6164 SHA1 (patch-lib_CL_devices_common.c) = c276aa967a1cc79b2bd6029b287b887bdb2b0010 +SHA1 (patch-lib_CL_devices_cpuinfo.c) = 70c4948c4948134e05d165ca0e8f6bd6fa68754b SHA1 (patch-lib_CL_devices_devices.c) = 17a5bb001086befdf88452b7e1126d2f5f4b1fc1 SHA1 (patch-lib_CL_devices_hsa_pocl-hsa.c) = b7b4798b6f47f4d60a914f45ba64fe8448accdb9 SHA1 (patch-lib_CL_devices_pthread_pthread.c) = afc0ab5544300d141d1fbfe5b7fe18af281365fa diff --git a/parallel/pocl/patches/patch-lib_CL_devices_cpuinfo.c b/parallel/pocl/patches/patch-lib_CL_devices_cpuinfo.c new file mode 100644 index 00000000000..2fb80d260e8 --- /dev/null +++ b/parallel/pocl/patches/patch-lib_CL_devices_cpuinfo.c @@ -0,0 +1,22 @@ +$NetBSD: patch-lib_CL_devices_cpuinfo.c,v 1.1 2021/06/10 11:18:06 nia Exp $ + +Do not segfault if /sys/bus/pci/devices/0000:00:00.0/vendor does not exist. + +--- lib/CL/devices/cpuinfo.c.orig 2021-05-19 08:12:19.000000000 +0000 ++++ lib/CL/devices/cpuinfo.c +@@ -416,9 +416,12 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_ + if (!device->vendor_id) + { + f = fopen (pci_bus_root_vendor_file, "r"); +- num_read = fscanf (f, "%x", &device->vendor_id); +- fclose (f); +- /* no error checking, if it failed we just won't have the info */ ++ if (f) ++ { ++ /* no error checking, if it failed we just won't have the info */ ++ num_read = fscanf (f, "%x", &device->vendor_id); ++ fclose (f); ++ } + } + } + -- cgit v1.2.3