All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zhijian <lizhijian@cn.fujitsu.com>
To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	shuah@kernel.org
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>,
	Pintu Agarwal <pintu.ping@gmail.com>
Subject: [PATCH 2/3] selftests/android: initialize heap_type to avoid compiling warning
Date: Mon,  2 Jul 2018 11:53:53 +0800	[thread overview]
Message-ID: <1530503634-32241-3-git-send-email-lizhijian@cn.fujitsu.com> (raw)
In-Reply-To: <1530503634-32241-2-git-send-email-lizhijian@cn.fujitsu.com>

root@vm-lkp-nex04-8G-7 ~/linux-v4.18-rc2/tools/testing/selftests/android# make
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: Entering directory '/root/linux-v4.18-rc2/tools/testing/selftests/android/ion'
gcc  -I. -I../../../../../drivers/staging/android/uapi/ -I../../../../../usr/include/ -Wall -O2 -g    ionapp_export.c ipcsocket.c ionutils.c   -o ionapp_export
ionapp_export.c: In function 'main':
ionapp_export.c:91:2: warning: 'heap_type' may be used uninitialized in
this function [-Wmaybe-uninitialized]
  printf("heap_type: %ld, heap_size: %ld\n", heap_type, heap_size);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CC: Shuah Khan <shuah@kernel.org>
CC: Pintu Agarwal <pintu.ping@gmail.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
 tools/testing/selftests/android/ion/ionapp_export.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/testing/selftests/android/ion/ionapp_export.c b/tools/testing/selftests/android/ion/ionapp_export.c
index a944e72..e3435c2 100644
--- a/tools/testing/selftests/android/ion/ionapp_export.c
+++ b/tools/testing/selftests/android/ion/ionapp_export.c
@@ -49,6 +49,7 @@ int main(int argc, char *argv[])
 		return -1;
 	}
 
+	heap_type = -1UL;
 	heap_size = 0;
 	flags = 0;
 
@@ -82,6 +83,12 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	if (heap_type == -1UL) {
+		printf("heap_type is invalid\n");
+		print_usage(argc, argv);
+		exit(1);
+	}
+
 	if (heap_size <= 0) {
 		printf("heap_size cannot be 0\n");
 		print_usage(argc, argv);
-- 
2.7.4


WARNING: multiple messages have this Message-ID (diff)
From: lizhijian at cn.fujitsu.com (Li Zhijian)
Subject: [PATCH 2/3] selftests/android: initialize heap_type to avoid compiling warning
Date: Mon,  2 Jul 2018 11:53:53 +0800	[thread overview]
Message-ID: <1530503634-32241-3-git-send-email-lizhijian@cn.fujitsu.com> (raw)
In-Reply-To: <1530503634-32241-2-git-send-email-lizhijian@cn.fujitsu.com>

root at vm-lkp-nex04-8G-7 ~/linux-v4.18-rc2/tools/testing/selftests/android# make
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: Entering directory '/root/linux-v4.18-rc2/tools/testing/selftests/android/ion'
gcc  -I. -I../../../../../drivers/staging/android/uapi/ -I../../../../../usr/include/ -Wall -O2 -g    ionapp_export.c ipcsocket.c ionutils.c   -o ionapp_export
ionapp_export.c: In function 'main':
ionapp_export.c:91:2: warning: 'heap_type' may be used uninitialized in
this function [-Wmaybe-uninitialized]
  printf("heap_type: %ld, heap_size: %ld\n", heap_type, heap_size);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CC: Shuah Khan <shuah at kernel.org>
CC: Pintu Agarwal <pintu.ping at gmail.com>
Signed-off-by: Li Zhijian <lizhijian at cn.fujitsu.com>
---
 tools/testing/selftests/android/ion/ionapp_export.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/testing/selftests/android/ion/ionapp_export.c b/tools/testing/selftests/android/ion/ionapp_export.c
index a944e72..e3435c2 100644
--- a/tools/testing/selftests/android/ion/ionapp_export.c
+++ b/tools/testing/selftests/android/ion/ionapp_export.c
@@ -49,6 +49,7 @@ int main(int argc, char *argv[])
 		return -1;
 	}
 
+	heap_type = -1UL;
 	heap_size = 0;
 	flags = 0;
 
@@ -82,6 +83,12 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	if (heap_type == -1UL) {
+		printf("heap_type is invalid\n");
+		print_usage(argc, argv);
+		exit(1);
+	}
+
 	if (heap_size <= 0) {
 		printf("heap_size cannot be 0\n");
 		print_usage(argc, argv);
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: lizhijian@cn.fujitsu.com (Li Zhijian)
Subject: [PATCH 2/3] selftests/android: initialize heap_type to avoid compiling warning
Date: Mon,  2 Jul 2018 11:53:53 +0800	[thread overview]
Message-ID: <1530503634-32241-3-git-send-email-lizhijian@cn.fujitsu.com> (raw)
Message-ID: <20180702035353.mn9mjWZ2PALflceM3uElnVGfnRUjKl-uHqWafglPRJw@z> (raw)
In-Reply-To: <1530503634-32241-2-git-send-email-lizhijian@cn.fujitsu.com>

root at vm-lkp-nex04-8G-7 ~/linux-v4.18-rc2/tools/testing/selftests/android# make
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: Entering directory '/root/linux-v4.18-rc2/tools/testing/selftests/android/ion'
gcc  -I. -I../../../../../drivers/staging/android/uapi/ -I../../../../../usr/include/ -Wall -O2 -g    ionapp_export.c ipcsocket.c ionutils.c   -o ionapp_export
ionapp_export.c: In function 'main':
ionapp_export.c:91:2: warning: 'heap_type' may be used uninitialized in
this function [-Wmaybe-uninitialized]
  printf("heap_type: %ld, heap_size: %ld\n", heap_type, heap_size);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CC: Shuah Khan <shuah at kernel.org>
CC: Pintu Agarwal <pintu.ping at gmail.com>
Signed-off-by: Li Zhijian <lizhijian at cn.fujitsu.com>
---
 tools/testing/selftests/android/ion/ionapp_export.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/testing/selftests/android/ion/ionapp_export.c b/tools/testing/selftests/android/ion/ionapp_export.c
index a944e72..e3435c2 100644
--- a/tools/testing/selftests/android/ion/ionapp_export.c
+++ b/tools/testing/selftests/android/ion/ionapp_export.c
@@ -49,6 +49,7 @@ int main(int argc, char *argv[])
 		return -1;
 	}
 
+	heap_type = -1UL;
 	heap_size = 0;
 	flags = 0;
 
@@ -82,6 +83,12 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	if (heap_type == -1UL) {
+		printf("heap_type is invalid\n");
+		print_usage(argc, argv);
+		exit(1);
+	}
+
 	if (heap_size <= 0) {
 		printf("heap_size cannot be 0\n");
 		print_usage(argc, argv);
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2018-07-02  3:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-02  3:53 [PATCH 0/3] fix selftests compiling errors and warnings Li Zhijian
2018-07-02  3:53 ` Li Zhijian
2018-07-02  3:53 ` lizhijian
2018-07-02  3:53 ` [PATCH 1/3] selftests/android: fix compiling error Li Zhijian
2018-07-02  3:53   ` Li Zhijian
2018-07-02  3:53   ` lizhijian
2018-07-02  3:53   ` Li Zhijian [this message]
2018-07-02  3:53     ` [PATCH 2/3] selftests/android: initialize heap_type to avoid compiling warning Li Zhijian
2018-07-02  3:53     ` lizhijian
2018-07-02  3:53     ` [PATCH 3/3] selftests/gpio: unset OUTPUT for build tools/gpio Li Zhijian
2018-07-02  3:53       ` Li Zhijian
2018-07-02  3:53       ` lizhijian
2018-07-10 14:50     ` [PATCH 2/3] selftests/android: initialize heap_type to avoid compiling warning Shuah Khan
2018-07-10 14:50       ` Shuah Khan
2018-07-10 14:50       ` shuah
2018-07-10 17:16       ` Pintu Kumar
2018-07-10 17:16         ` Pintu Kumar
2018-07-10 17:16         ` pintu.ping
2018-07-10  8:38 ` [PATCH 0/3] fix selftests compiling errors and warnings Li Zhijian
2018-07-10  8:38   ` Li Zhijian
2018-07-10  8:38   ` lizhijian
2018-07-10 14:08   ` Shuah Khan
2018-07-10 14:08     ` Shuah Khan
2018-07-10 14:08     ` shuah
2018-07-11  1:37     ` Li Zhijian
2018-07-11  1:37       ` Li Zhijian
2018-07-11  1:37       ` lizhijian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1530503634-32241-3-git-send-email-lizhijian@cn.fujitsu.com \
    --to=lizhijian@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=pintu.ping@gmail.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.