File f2193587.patch of Package haveged

From f2193587e8e51aa42b192c17ad39467931e2d4c2 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 19 Sep 2018 09:51:43 +0200
Subject: [PATCH] Fix segfault on arm machines

Some ARM cpus does not report the cache size or say it is -1 in sysfs.
It has been observed on xgene and thunderx machines.

Fall back to the generic cache size when that happens so we don't
segfault.

Should fix https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866306
---
 src/havegetune.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/src/havegetune.c
+++ b/src/havegetune.c	2018-09-19 09:25:27.016773887 +0000
@@ -795,6 +795,8 @@ static int vfs_configInfoCache(
          ctype = vfs_configFile(pAnchor, path, vfs_configType);
          strcpy(path+plen, "size");
          size  = vfs_configFile(pAnchor, path, vfs_configInt);
+         if (size == -1)
+               size = ctype == 'I' ? GENERIC_ICACHE : GENERIC_DCACHE;
          cfg_cacheAdd(pAnchor, SRC_VFS_INDEX,  pArgs[1], level, ctype, size);
          }
      }
openSUSE Build Service is sponsored by