From patchwork Fri Mar 2 08:02:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinhui Huang X-Patchwork-Id: 880363 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zt1xp3hzXz9sWQ for ; Fri, 2 Mar 2018 19:02:52 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 70F523E76D5 for ; Fri, 2 Mar 2018 09:02:49 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2]) by picard.linux.it (Postfix) with ESMTP id D285A3E76E3 for ; Fri, 2 Mar 2018 09:02:46 +0100 (CET) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-2.smtp.seeweb.it (Postfix) with ESMTP id 5925B600BC0 for ; Fri, 2 Mar 2018 09:02:44 +0100 (CET) X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="37417961" Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 02 Mar 2018 16:02:36 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 02D9A48AE762 for ; Fri, 2 Mar 2018 16:02:33 +0800 (CST) Received: from localhost.localdomain (10.167.220.196) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 2 Mar 2018 16:02:31 +0800 From: Jinhui Huang To: Date: Fri, 2 Mar 2018 16:02:23 +0800 Message-ID: <1519977744-1595-2-git-send-email-huangjh.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1519977744-1595-1-git-send-email-huangjh.jy@cn.fujitsu.com> References: <1519977744-1595-1-git-send-email-huangjh.jy@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.196] X-yoursite-MailScanner-ID: 02D9A48AE762.AF066 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: huangjh.jy@cn.fujitsu.com X-Spam-Status: No, score=-0.0 required=7.0 tests=T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH 2/3] syscalls/pipe*: Fix compiler warnings X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Jinhui Huang --- testcases/kernel/syscalls/pipe/pipe04.c | 2 +- testcases/kernel/syscalls/pipe/pipe05.c | 4 ++-- testcases/kernel/syscalls/pipe/pipe07.c | 2 +- testcases/kernel/syscalls/pipe/pipe08.c | 2 ++ testcases/kernel/syscalls/pipe/pipe11.c | 6 +++--- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/testcases/kernel/syscalls/pipe/pipe04.c b/testcases/kernel/syscalls/pipe/pipe04.c index b3d255b..a3c56e3 100644 --- a/testcases/kernel/syscalls/pipe/pipe04.c +++ b/testcases/kernel/syscalls/pipe/pipe04.c @@ -235,7 +235,7 @@ void c2func(void) tst_resm(TBROK | TERRNO, "[child 2] pipe write failed"); } -void alarmfunc(int sig) +void alarmfunc(int sig LTP_ATTRIBUTE_UNUSED) { /* for some reason tst_brkm doesn't seem to work in a signal handler */ tst_brkm(TFAIL, cleanup, "one or more children did't die in 60 second " diff --git a/testcases/kernel/syscalls/pipe/pipe05.c b/testcases/kernel/syscalls/pipe/pipe05.c index fe5ec37..4105988 100644 --- a/testcases/kernel/syscalls/pipe/pipe05.c +++ b/testcases/kernel/syscalls/pipe/pipe05.c @@ -59,7 +59,7 @@ void sig11_handler(int sig); int main(int ac, char **av) { - int lc; + volatile int lc; struct sigaction sa, osa; tst_parse_opts(ac, av, NULL, NULL); @@ -120,7 +120,7 @@ void setup(void) /****************************************************************** * sig11_handler() - our segfault recover hack ******************************************************************/ -void sig11_handler(int sig) +void sig11_handler(int sig LTP_ATTRIBUTE_UNUSED) { longjmp(sig11_recover, 1); } diff --git a/testcases/kernel/syscalls/pipe/pipe07.c b/testcases/kernel/syscalls/pipe/pipe07.c index b09df71..55bb9f4 100644 --- a/testcases/kernel/syscalls/pipe/pipe07.c +++ b/testcases/kernel/syscalls/pipe/pipe07.c @@ -129,7 +129,7 @@ static void record_open_fds(void) if (fd == dir_fd) continue; - if (rec_fds_max >= ARRAY_SIZE(rec_fds)) { + if (rec_fds_max >= (int)ARRAY_SIZE(rec_fds)) { tst_brkm(TBROK, cleanup, "Too much file descriptors open"); } diff --git a/testcases/kernel/syscalls/pipe/pipe08.c b/testcases/kernel/syscalls/pipe/pipe08.c index cdb2a4d..9f8d9cc 100644 --- a/testcases/kernel/syscalls/pipe/pipe08.c +++ b/testcases/kernel/syscalls/pipe/pipe08.c @@ -98,6 +98,8 @@ int main(int ac, char **av) * sent */ written = write(pipefd[1], wrbuf, length); + if (written > 0) + tst_brkm(TBROK, cleanup, "write succeeded expectedly"); } cleanup(); tst_exit(); diff --git a/testcases/kernel/syscalls/pipe/pipe11.c b/testcases/kernel/syscalls/pipe/pipe11.c index e11c556..e3b2741 100644 --- a/testcases/kernel/syscalls/pipe/pipe11.c +++ b/testcases/kernel/syscalls/pipe/pipe11.c @@ -198,7 +198,8 @@ void do_child_uclinux(void) */ void setup(void) { - int i, j; + int i; + unsigned int j; tst_sig(FORK, DEF_HANDLER, cleanup); @@ -230,9 +231,8 @@ void setup(void) j = 0; for (i = 0; i < szcharbuf;) { wrbuf[i++] = rawchars[j++]; - if (j >= sizeof(rawchars)) { + if (j >= sizeof(rawchars)) j = 0; - } } }