From patchwork Thu Apr 19 10:55:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yang xu X-Patchwork-Id: 900770 X-Patchwork-Delegate: chrubis@suse.cz 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=213.254.12.146; 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 [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40RbWk0Zxwz9s1P for ; Thu, 19 Apr 2018 20:56:17 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id E5EBF3E767F for ; Thu, 19 Apr 2018 12:56:14 +0200 (CEST) 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 [IPv6:2001:4b78:1:20::2]) by picard.linux.it (Postfix) with ESMTP id 9BC353E749B for ; Thu, 19 Apr 2018 12:56:13 +0200 (CEST) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-2.smtp.seeweb.it (Postfix) with ESMTP id 0FB7D600C7C for ; Thu, 19 Apr 2018 12:56:11 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="39140836" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 19 Apr 2018 18:56:02 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id A883F48AE940; Thu, 19 Apr 2018 18:56:03 +0800 (CST) Received: from localhost.localdomain (10.167.220.182) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 19 Apr 2018 18:56:02 +0800 From: yang xu To: Date: Thu, 19 Apr 2018 18:55:57 +0800 Message-ID: <1524135357-24852-1-git-send-email-xuyang.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <20180419100714.GA27089@rei> References: <20180419100714.GA27089@rei> MIME-Version: 1.0 X-Originating-IP: [10.167.220.182] X-yoursite-MailScanner-ID: A883F48AE940.AD2D5 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: xuyang.jy@cn.fujitsu.com X-Spam-Status: No, score=0.0 required=7.0 tests=none 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 Cc: ltp@lists.linux.it Subject: [LTP] [PATCH] syscalls/mkdir03: Use tst_get_bad_addr() 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" 1) Remove useless struct member Signed-off-by: yang xu --- testcases/kernel/syscalls/mkdir/mkdir03.c | 32 ++++++++++++------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/testcases/kernel/syscalls/mkdir/mkdir03.c b/testcases/kernel/syscalls/mkdir/mkdir03.c index 5d7f1e1..9441afe 100644 --- a/testcases/kernel/syscalls/mkdir/mkdir03.c +++ b/testcases/kernel/syscalls/mkdir/mkdir03.c @@ -46,20 +46,18 @@ static char long_dir[PATH_MAX + 2] = {[0 ... PATH_MAX + 1] = 'a'}; static char loop_dir[PATH_MAX] = "."; struct tcase; -static void prot_none_pathname(struct tcase *tc); static struct tcase { char *pathname; int exp_errno; - void (*setupfunc)(struct tcase *tc); } TC[] = { - {NULL, EFAULT, prot_none_pathname}, - {long_dir, ENAMETOOLONG, NULL}, - {TST_EEXIST, EEXIST, NULL}, - {TST_ENOENT, ENOENT, NULL}, - {TST_ENOTDIR_DIR, ENOTDIR, NULL}, - {loop_dir, ELOOP, NULL}, - {TST_EROFS, EROFS, NULL}, + {NULL, EFAULT}, + {long_dir, ENAMETOOLONG}, + {TST_EEXIST, EEXIST}, + {TST_ENOENT, ENOENT}, + {TST_ENOTDIR_DIR, ENOTDIR}, + {loop_dir, ELOOP}, + {TST_EROFS, EROFS}, }; static void verify_mkdir(unsigned int n) @@ -82,12 +80,6 @@ static void verify_mkdir(unsigned int n) } } -static void prot_none_pathname(struct tcase *tc) -{ - tc->pathname = SAFE_MMAP(0, 1, PROT_NONE, - MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); -} - static void setup(void) { unsigned int i; @@ -95,15 +87,15 @@ static void setup(void) SAFE_TOUCH(TST_EEXIST, MODE, NULL); SAFE_TOUCH(TST_ENOTDIR_FILE, MODE, NULL); + for (i = 0; i < ARRAY_SIZE(TC); i++) { + if (TC[i].exp_errno == EFAULT) + TC[i].pathname = tst_get_bad_addr(NULL); + } + SAFE_MKDIR("test_eloop", DIR_MODE); SAFE_SYMLINK("../test_eloop", "test_eloop/test_eloop"); for (i = 0; i < 43; i++) strcat(loop_dir, "/test_eloop"); - - for (i = 0; i < ARRAY_SIZE(TC); i++) { - if (TC[i].setupfunc) - TC[i].setupfunc(&TC[i]); - } } static struct tst_test test = {