Blame SOURCES/0002-avoid-calling-memset-with-zero-length.patch

f567cd
From 378ffb7cca7fca1cb64ff3a2e50496c18011dd07 Mon Sep 17 00:00:00 2001
f567cd
From: Michal Schmidt <mschmidt@redhat.com>
f567cd
Date: Wed, 12 Aug 2015 14:25:53 +0200
f567cd
Subject: [PATCH] avoid calling memset with zero length
f567cd
f567cd
This avoids the following build error:
f567cd
f567cd
In file included from /usr/include/string.h:638:0,
f567cd
                 from ./include/opa_user.h:77,
f567cd
                 from psm_user.h:67,
f567cd
                 from psm_diags.c:56:
f567cd
In function 'memset',
f567cd
    inlined from 'memcpy_check_one.constprop.4' at psm_diags.c:278:8,
f567cd
    inlined from 'memcpy_check_size.constprop.2' at psm_diags.c:335:30,
f567cd
    inlined from 'psmi_test_memcpy.constprop.1' at psm_diags.c:230:6,
f567cd
    inlined from 'psmi_diags' at psm_diags.c:84:25:
f567cd
/usr/include/bits/string3.h:81:30: error: call to
f567cd
'__warn_memset_zero_len' declared with attribute warning: memset used
f567cd
with constant zero length parameter; this could be due to transposed
f567cd
parameters [-Werror]
f567cd
       __warn_memset_zero_len ();
f567cd
                              ^
f567cd
---
f567cd
 psm_diags.c | 4 ++++
f567cd
 1 file changed, 4 insertions(+)
f567cd
f567cd
diff --git a/psm_diags.c b/psm_diags.c
f567cd
index 286e72bd8a..152968750c 100644
f567cd
--- a/psm_diags.c
f567cd
+++ b/psm_diags.c
f567cd
@@ -275,6 +275,10 @@ void *memcpy_check_one(memcpy_fn_t fn, void *dst, void *src, size_t n)
f567cd
 	    ((uintptr_t) dst ^ (uintptr_t) src ^ (uintptr_t) n);
f567cd
 	unsigned int state;
f567cd
 	size_t i;
f567cd
+
f567cd
+	if (!n)
f567cd
+		return dst;
f567cd
+
f567cd
 	memset(src, 0x55, n);
f567cd
 	memset(dst, 0xaa, n);
f567cd
 	srand(seed);
f567cd
-- 
f567cd
2.4.3
f567cd