Skip to contentSkip to conversation

mdadm: fix CFLAGS and ptest issue

PATCH In review [email protected] 2 participants 4 messages Oct 16, 2015 – Nov 7, 2015

lore
Share & tools
lore
#0 lore raw

v2 cover mdadm: fix CFLAGS and ptest issue

From: Wenzong Fan <[email protected]>

V2 changes:

* update commit subject:
mdadm: fix CFLAGS invalid issue -> mdadm: fix CFLAGS and ptest issue

* rebase changes against latest master branch.

The following changes since commit 556c0ea92eb32ddb9c9a5e30a74b2ca24ac69c68:

lib/oe/image.py: Fix dependency handling for compressed types (2015-10-14 18:08:37 +0300)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib wenzong/mdadm
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/mdadm

Wenzong Fan (1):
mdadm: fix CFLAGS and ptest issue

 .../mdadm/files/mdadm-fix-ptest-build-error.patch  | 34 ++++++++++++++++++++++
 meta/recipes-extended/mdadm/mdadm_3.3.4.bb         |  3 +-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/mdadm/files/mdadm-fix-ptest-build-error.patch
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 mdadm: fix CFLAGS and ptest issue

From: Wenzong Fan <[email protected]>

* Pass global CFLAGS to build:

The CFLAGS does not pass to build at all since it was redefined by mdadm Makefile:

  CFLAGS = $(CWFLAGS) $(CXFLAGS) ...

This could be done by setting 'CXFLAGS="${CFLAGS}"'.

* Also fix ptest build error caused by global CFLAGS:

raid6check.c: In function 'check_stripes':
raid6check.c:315:8: error: 'stripe_buf' may be used uninitialized \
in this function [-Werror=maybe-uninitialized]

---
 .../mdadm/files/mdadm-fix-ptest-build-error.patch  | 34 ++++++++++++++++++++++
 meta/recipes-extended/mdadm/mdadm_3.3.4.bb         |  3 +-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/mdadm/files/mdadm-fix-ptest-build-error.patch
meta/recipes-extended/mdadm/files/mdadm-fix-ptest-build-error.patch new file +34 -0
new file mode 100644
index 0000000..b2495c0
@@ -0,0 +1,34 @@
+From d062030a36faa77193ac66b498a1ec704013dbb1 Mon Sep 17 00:00:00 2001
+From: Wenzong Fan <[email protected]>
+Date: Thu, 10 Sep 2015 03:52:20 -0400
+Subject: [PATCH] mdadm: fix ptest build error
+
+Initialize *stripe_buf as NULL to fix ptest build error:
+
+  raid6check.c: In function 'check_stripes':
+  raid6check.c:315:8: error: 'stripe_buf' may be used uninitialized \
+  in this function [-Werror=maybe-uninitialized]
+
+Upstream-Status: Pending
+
+Signed-off-by: Wenzong Fan <[email protected]>
+---
+ raid6check.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/raid6check.c b/raid6check.c
+index cb8522e..e4a9ff0 100644
+--- a/raid6check.c
++++ b/raid6check.c
+@@ -312,7 +312,7 @@ int check_stripes(struct mdinfo *info, int *source, unsigned long long *offsets,
+ 	/* read the data and p and q blocks, and check we got them right */
+ 	int data_disks = raid_disks - 2;
+ 	int syndrome_disks = data_disks + is_ddf(layout) * 2;
+-	char *stripe_buf;
++	char *stripe_buf = NULL;
+ 
+ 	/* stripes[] is indexed by raid_disk and holds chunks from each device */
+ 	char **stripes = xmalloc(raid_disks * sizeof(char*));
+-- 
+1.9.1
+
meta/recipes-extended/mdadm/mdadm_3.3.4.bb +2 -1
index 1198167..ed56b11 100644
@@ -13,6 +13,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
            file://gcc-4.9.patch \
            file://mdadm-3.3.2_x32_abi_time_t.patch \
            file://0001-Fix-typo-in-comparision.patch \
+           file://mdadm-fix-ptest-build-error.patch \
            file://run-ptest \
 	  "
 SRC_URI[md5sum] = "7ca8b114710f98f53f20c5787b674a09"
@@ -22,7 +23,7 @@ CFLAGS += "-fno-strict-aliasing"
 
 inherit autotools-brokensep
 
-EXTRA_OEMAKE = "CHECK_RUN_DIR=0"
+EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CXFLAGS="${CFLAGS}"'
 # PPC64 and MIPS64 uses long long for u64 in the kernel, but powerpc's asm/types.h
 # prevents 64-bit userland from seeing this definition, instead defaulting
 # to u64 == long in userspace. Define __SANE_USERSPACE_TYPES__ to get
Signature · 1 line
1.9.1
#2 lore raw
Quoted 6 lines · On 16 October 2015 at 06:57, <[email protected]> wrote:

* Also fix ptest build error caused by global CFLAGS:

raid6check.c: In function 'check_stripes':
raid6check.c:315:8: error: 'stripe_buf' may be used uninitialized \
in this function [-Werror=maybe-uninitialized]

We're now seeing this instead when building the ptest part on poky-lsb (which turns on more security flags):

raid6check.c: In function 'check_stripes':
raid6check.c:352:2: error: ignoring return value of 'posix_memalign', declared with attribute warn_unused_result [-Werror=unused-result]
posix_memalign((void**)&stripe_buf, 4096, raid_disks * chunk_size); ^

(http://errors.yoctoproject.org/Errors/Details/21490/)

Ross

#3 lore raw
Quoted 11 lines · Ross

On 16 October 2015 at 06:57, <[email protected] <mailto:[email protected]>> wrote:

* Also fix ptest build error caused by global CFLAGS:

raid6check.c: In function 'check_stripes':
raid6check.c:315:8: error: 'stripe_buf' may be used uninitialized \
in this function [-Werror=maybe-uninitialized]

Quoted 7 lines

We're now seeing this instead when building the ptest part on poky-lsb (which turns on more security flags):

raid6check.c: In function 'check_stripes':
raid6check.c:352:2: error: ignoring return value of 'posix_memalign', declared with attribute warn_unused_result [-Werror=unused-result]
posix_memalign((void**)&stripe_buf, 4096, raid_disks * chunk_size);

I'll fix the patch and send v2 out.

Thanks
Wenzong

Quoted 5 lines

(http://errors.yoctoproject.org/Errors/Details/21490/)

Ross