Patchwork [meta-networking,2/2] ipsec-tools: fix compilation warning with gcc 4.8

login
register
mail settings
Submitter Paul Barker
Date June 14, 2013, 5:20 p.m.
Message ID <1371230436-10343-2-git-send-email-paul@paulbarker.me.uk>
Download mbox | patch
Permalink /patch/51739/
State Accepted, archived
Headers show

Comments

Paul Barker - June 14, 2013, 5:20 p.m.
The line "memset(pair, 0, sizeof(pair));" was causing the following warning:

	error: argument to 'sizeof' in 'memset' call is the same expression as
	the destination; did you mean to dereference

Compiling with -Werror (as specified in configure.ac) was causing this warning
to become an error. The line itself is not needed as memory is allocated via
calloc which performs zero initialization. Therefore, the line is removed to fix
the warning and does not need replacing anything.

Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
---
 .../files/0001-Fix-warning-with-gcc-4.8.patch      | 36 ++++++++++++++++++++++
 .../ipsec-tools/ipsec-tools_0.8.1.bb               |  2 ++
 2 files changed, 38 insertions(+)
 create mode 100644 meta-networking/recipes-support/ipsec-tools/files/0001-Fix-warning-with-gcc-4.8.patch

Patch

diff --git a/meta-networking/recipes-support/ipsec-tools/files/0001-Fix-warning-with-gcc-4.8.patch b/meta-networking/recipes-support/ipsec-tools/files/0001-Fix-warning-with-gcc-4.8.patch
new file mode 100644
index 0000000..0c85ea8
--- /dev/null
+++ b/meta-networking/recipes-support/ipsec-tools/files/0001-Fix-warning-with-gcc-4.8.patch
@@ -0,0 +1,36 @@ 
+From 7892a5b79db38902dc01715f42dd09ef2b35653b Mon Sep 17 00:00:00 2001
+From: Paul Barker <paul@paulbarker.me.uk>
+Date: Wed, 12 Jun 2013 17:39:06 +0100
+Subject: [PATCH] Fix warning with gcc 4.8.
+
+The line "memset(pair, 0, sizeof(pair));" was causing the following warning:
+
+	error: argument to 'sizeof' in 'memset' call is the same expression as
+	the destination; did you mean to dereference
+
+Compiling with -Werror (as specified in configure.ac) was causing this warning
+to become an error. The line itself is not needed as memory is allocated via
+calloc which performs zero initialization. Therefore, the line is removed to fix
+the warning and does not need replacing anything.
+
+Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
+Upstream-Status: Submitted
+---
+ src/racoon/ipsec_doi.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/racoon/ipsec_doi.c b/src/racoon/ipsec_doi.c
+index 2b48d49..4e9d3a8 100644
+--- a/src/racoon/ipsec_doi.c
++++ b/src/racoon/ipsec_doi.c
+@@ -1183,7 +1183,6 @@ get_proppair_and_doi_sit(sa, mode, doitype, sittype)
+ 			"failed to get buffer.\n");
+ 		goto bad;
+ 	}
+-	memset(pair, 0, sizeof(pair));
+ 
+ 	bp = (caddr_t)(sab + 1);
+ 	tlen = sa->l - sizeof(*sab);
+-- 
+1.8.3
+
diff --git a/meta-networking/recipes-support/ipsec-tools/ipsec-tools_0.8.1.bb b/meta-networking/recipes-support/ipsec-tools/ipsec-tools_0.8.1.bb
index e8178ce..1f8017e 100644
--- a/meta-networking/recipes-support/ipsec-tools/ipsec-tools_0.8.1.bb
+++ b/meta-networking/recipes-support/ipsec-tools/ipsec-tools_0.8.1.bb
@@ -4,3 +4,5 @@  LIC_FILES_CHKSUM = "file://src/libipsec/pfkey.c;beginline=6;endline=31;md5=bc9b7
 
 SRC_URI[ipsec-tools-0.8.1.md5sum] = "d38b39f291ba2962387c3232e7335dd8"
 SRC_URI[ipsec-tools-0.8.1.sha256sum] = "fa4a95bb36842f001b84c4e7a1bb727e3ee06147edbc830a881d63abe8153dd4"
+
+SRC_URI += "file://0001-Fix-warning-with-gcc-4.8.patch"