Patchwork [2/3] LTP: pthread_cond_many - fix uninitialized return in parse_args

login
register
mail settings
Submitter gary.robertson@linaro.org
Date July 25, 2014, 10:20 p.m.
Message ID <1406326845-17506-3-git-send-email-gary.robertson@linaro.org>
Download mbox | patch
Permalink /patch/76695/
State New
Headers show

Comments

gary.robertson@linaro.org - July 25, 2014, 10:20 p.m.
From: "Gary S. Robertson" <gary.robertson@linaro.org>

The parse_args() function in realtime test pthread_cond_many contains
a switch statement im which some cases failed to initialize the
function return variable prior to returning... added an init clause
to the definition statement for the return variable.

Signed-off-by: Gary S. Robertson <gary.robertson@linaro.org>
---
 ...d_many-fix-uninitialized-return-in-option.patch |   31 ++++++++++++++++++++
 meta/recipes-extended/ltp/ltp_20140422.bb          |    1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta/recipes-extended/ltp/ltp/0001-pthread_cond_many-fix-uninitialized-return-in-option.patch
gary.robertson@linaro.org - Aug. 14, 2014, 9:35 p.m.
I wish to drop this patch thread and re-submit the patches individually
rather than as a group - thanks.


On Fri, Jul 25, 2014 at 5:20 PM, Gary S. Robertson <
gary.robertson@linaro.org> wrote:

> From: "Gary S. Robertson" <gary.robertson@linaro.org>
>
> The parse_args() function in realtime test pthread_cond_many contains
> a switch statement im which some cases failed to initialize the
> function return variable prior to returning... added an init clause
> to the definition statement for the return variable.
>
> Signed-off-by: Gary S. Robertson <gary.robertson@linaro.org>
> ---
>  ...d_many-fix-uninitialized-return-in-option.patch |   31
> ++++++++++++++++++++
>  meta/recipes-extended/ltp/ltp_20140422.bb          |    1 +
>  2 files changed, 32 insertions(+)
>  create mode 100644
> meta/recipes-extended/ltp/ltp/0001-pthread_cond_many-fix-uninitialized-return-in-option.patch
>
> diff --git
> a/meta/recipes-extended/ltp/ltp/0001-pthread_cond_many-fix-uninitialized-return-in-option.patch
> b/meta/recipes-extended/ltp/ltp/0001-pthread_cond_many-fix-uninitialized-return-in-option.patch
> new file mode 100644
> index 0000000..90c9d8e
> --- /dev/null
> +++
> b/meta/recipes-extended/ltp/ltp/0001-pthread_cond_many-fix-uninitialized-return-in-option.patch
> @@ -0,0 +1,31 @@
> +From 409c00bf4484d40380947fd27329b64ebee29874 Mon Sep 17 00:00:00 2001
> +From: "Gary S. Robertson" <gary.robertson@linaro.org>
> +Date: Fri, 25 Jul 2014 09:41:51 -0500
> +Subject: [PATCH] pthread_cond_many: fix uninitialized return in option
> + handling
> +
> +Some of the cases in the switch statement in parse_args() did not
> +initialize the 'handled' variable which is returned by the function.
> +Added an initialization to the definition of the variable.
> +
> +Signed-off-by: Gary S. Robertson <gary.robertson@linaro.org>
> +---
> + .../realtime/perf/latency/pthread_cond_many.c      |    2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/testcases/realtime/perf/latency/pthread_cond_many.c
> b/testcases/realtime/perf/latency/pthread_cond_many.c
> +index f9325b5..1d39100 100644
> +--- a/testcases/realtime/perf/latency/pthread_cond_many.c
> ++++ b/testcases/realtime/perf/latency/pthread_cond_many.c
> +@@ -256,7 +256,7 @@ void usage(void)
> +
> + int parse_args(int c, char *v)
> + {
> +-      int handled;
> ++      int handled = 1;
> +       switch (c) {
> +       case 'h':
> +               usage();
> +--
> +1.7.9.5
> +
> diff --git a/meta/recipes-extended/ltp/ltp_20140422.bb
> b/meta/recipes-extended/ltp/ltp_20140422.bb
> index 2ac2187..f86a195 100644
> --- a/meta/recipes-extended/ltp/ltp_20140422.bb
> +++ b/meta/recipes-extended/ltp/ltp_20140422.bb
> @@ -27,6 +27,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
>      file://ltp-Do-not-link-against-libfl.patch \
>      file://automake-foreign.patch \
>      file://0001-Allow-mutex-initialization-without-PI-configured.patch \
> +
>  file://0001-pthread_cond_many-fix-uninitialized-return-in-option.patch \
>  "
>
>  S = "${WORKDIR}/git"
> --
> 1.7.9.5
>
>

Patch

diff --git a/meta/recipes-extended/ltp/ltp/0001-pthread_cond_many-fix-uninitialized-return-in-option.patch b/meta/recipes-extended/ltp/ltp/0001-pthread_cond_many-fix-uninitialized-return-in-option.patch
new file mode 100644
index 0000000..90c9d8e
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0001-pthread_cond_many-fix-uninitialized-return-in-option.patch
@@ -0,0 +1,31 @@ 
+From 409c00bf4484d40380947fd27329b64ebee29874 Mon Sep 17 00:00:00 2001
+From: "Gary S. Robertson" <gary.robertson@linaro.org>
+Date: Fri, 25 Jul 2014 09:41:51 -0500
+Subject: [PATCH] pthread_cond_many: fix uninitialized return in option
+ handling
+
+Some of the cases in the switch statement in parse_args() did not
+initialize the 'handled' variable which is returned by the function.
+Added an initialization to the definition of the variable.
+
+Signed-off-by: Gary S. Robertson <gary.robertson@linaro.org>
+---
+ .../realtime/perf/latency/pthread_cond_many.c      |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/testcases/realtime/perf/latency/pthread_cond_many.c b/testcases/realtime/perf/latency/pthread_cond_many.c
+index f9325b5..1d39100 100644
+--- a/testcases/realtime/perf/latency/pthread_cond_many.c
++++ b/testcases/realtime/perf/latency/pthread_cond_many.c
+@@ -256,7 +256,7 @@ void usage(void)
+ 
+ int parse_args(int c, char *v)
+ {
+-	int handled;
++	int handled = 1;
+ 	switch (c) {
+ 	case 'h':
+ 		usage();
+-- 
+1.7.9.5
+
diff --git a/meta/recipes-extended/ltp/ltp_20140422.bb b/meta/recipes-extended/ltp/ltp_20140422.bb
index 2ac2187..f86a195 100644
--- a/meta/recipes-extended/ltp/ltp_20140422.bb
+++ b/meta/recipes-extended/ltp/ltp_20140422.bb
@@ -27,6 +27,7 @@  SRC_URI = "git://github.com/linux-test-project/ltp.git \
     file://ltp-Do-not-link-against-libfl.patch \
     file://automake-foreign.patch \
     file://0001-Allow-mutex-initialization-without-PI-configured.patch \
+    file://0001-pthread_cond_many-fix-uninitialized-return-in-option.patch \
 "
 
 S = "${WORKDIR}/git"