From patchwork Mon May 20 18:52:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13668626 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F617C25B77 for ; Mon, 20 May 2024 19:53:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B845E6B0093; Mon, 20 May 2024 15:53:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B33EF6B0095; Mon, 20 May 2024 15:53:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A228B6B0096; Mon, 20 May 2024 15:53:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 855046B0093 for ; Mon, 20 May 2024 15:53:57 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 284961A0F05 for ; Mon, 20 May 2024 19:53:57 +0000 (UTC) X-FDA: 82139824914.06.0F06945 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf23.hostedemail.com (Postfix) with ESMTP id 95B42140005 for ; Mon, 20 May 2024 19:53:55 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=VhUZLS06; spf=pass (imf23.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=quarantine) header.from=collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716234835; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=RNe0v1hiI+Na3lqfkBzoVhozidzz71A9MmldK4qsP1k=; b=ugt+C17gZe0NePq6UwWHA8b19akeDkIZVKF3pPlqQs0uXvaUBzZGpP+dkouWgN4ST9FMPv 4mQPQlKQBMEbKFGKowbb7OGGVa/im2w4aXDuGHeISc/9+OrLkKCEQqp2FQS7oWIKPkkEZO WctnKS6eREpl+KOXXtbFtfcmFYiUkl4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716234835; a=rsa-sha256; cv=none; b=DuHQjxpoQUKQmGyChOELGI1d0BBt1VrMf9jefX7s0ERmecpgZk1+VqX0h4QmsmUgfRD+Km jBm+IuxvTNPTCjHwGKBrH1O2VHKR2HasA0ezpfWUcuLvXwjA+nWWl+q4uAn4znyVuhUSoX Sw7/uz8hQdAn0E+9SEPpNYjCbusYYRU= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=VhUZLS06; spf=pass (imf23.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=quarantine) header.from=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1716234833; bh=QxwadSFkxmRXFr0xxxHIn2pF5xPts2dxqh+DBylu7mQ=; h=From:To:Cc:Subject:Date:From; b=VhUZLS06j1YdBnQbzv56wlvUR5HQvP/1AvkKKjbuDbLyWBUR182YzrNpA53jj0242 /XfRVzmz2NPwJEqJ4wd3q1geEWlr3zMB3hKvXqSCwwLwldwYxWeCJt72l0fQ3kneEc vlqrJdesHy/9tfTO5izTPOAmQKFQymdSt2ocrpWD2o1Al0Tds8TQgKcOziaLorI9au CZ5KW2RBAZAHfCsmQjPa2KhipqUUce1J40a4H6aU1WN+tiM6K7JL5qB7Ly8DW+u324 disEcT1fkvvegQKdSYQvjt9vIAhmHagZsTdVqE5TtD8nBypirSCIvwOI1ug//FF0tI aZUYxFQM7Ln4Q== Received: from localhost.localdomain (ec2-34-240-57-77.eu-west-1.compute.amazonaws.com [34.240.57.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 317083780BFE; Mon, 20 May 2024 19:53:52 +0000 (UTC) From: Muhammad Usama Anjum To: Andrew Morton , Shuah Khan , Muhammad Usama Anjum Cc: kernel@collabora.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] selftests: mm: check return values Date: Mon, 20 May 2024 11:52:48 -0700 Message-Id: <20240520185248.1801945-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: yyxw48gi1abcuauusp5yw7iby4jpnfxh X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 95B42140005 X-HE-Tag: 1716234835-787658 X-HE-Meta: U2FsdGVkX1/ylv1G5n8Y9pO7Fypw3IalCSnfikwYozC3FniLaRPX40Wvv0mE6ljS8eVSt1ERIgeC48F32XTIJaI/1NuPXYSyJRX312l6kZKh6SAPFTp8AlK2Nf4xVjY+7Dn2gkJ+CVDxthZMjYAk57zfEC5Rj2+5bWlMikzhrf4i6YZcA7GIRWtmfVUPBaLEDyENyx7fvsO0E/hhoUptKtqdVKuwPwklmdByPaw9wXlASM4I2x/xi8m+mB+FcjPQeex24erHB+iSFHrOEP1kynWTik7qg21FLSZ10TEyx2xbG/PWqd58Qx6/wtB3sDy24D1RzTyy1rqEeP34NlQB1C1twm8AwWqb+hN2/PcmnEAGO9yLDLq2bM7TPyMjUJleixWOQJf51OJZumZi+7McL/+Nnxebe4nMfeSYFBeqqQQYGRep9ZKZmF6lPCmiLR+xgfAT8VkenKf6ALXLZrulw72XLX8ji6AwpJO+pAq6YAH63bz0CQgK2NQN/Gkzse5F4zLl4jINrUVXLGhsQe8hm6RBQuNazKQBnfyIx1NwovS96ZJxirKOC4WjnB+kj0l2FXiqEq39GO+p8pggmG4tZCTjQi4TsIhk4s5fgXrrpIVel2dXXft19ld9CkYhUpnA9/6hLVGmdX1ndPEISrUvhW/vkzJw8xL469AgK1QmKX2xYO6MM8l2dVGmimoc/t84PKA79EcRv81Z4vUbPZSs7lunTpHH8nFLK9b4D9HPvC0vbTQewpmL2Dfnfhyy+WHpUrXX0X3ENIvkC11/ZZPga9OQ3/agvF5eH5Kqg2iwpesLD89UCDMaML1vgQyV6ESudMQSHDYZNx62Ya3Ug/jJRoh6zpAQ2PkGJv3p1lDXl2s3+CU9t6NVAarceFXNykzL9SbP6RJvoeXfD+M57y60Chc56W7GYrjX9S7yfqoLl+sspImRZNKbI1rq81rHcLAGp7pw+UUnQTG0p/4I4k2 uMbwM5t8 77dxKgM6uKddGUJXCZw3TJhQK74ScVRMOVKPGW5y+MhvpEhDgbWtzCq6+zg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Check return value and return error/skip the tests. Fixes: 46fd75d4a3c9 ("selftests: mm: add pagemap ioctl tests") Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/pagemap_ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/selftests/mm/pagemap_ioctl.c index 2d785aca72a5c..bcc73b4e805c6 100644 --- a/tools/testing/selftests/mm/pagemap_ioctl.c +++ b/tools/testing/selftests/mm/pagemap_ioctl.c @@ -1567,8 +1567,10 @@ int main(int argc, char *argv[]) /* 7. File Hugetlb testing */ mem_size = 2*1024*1024; fd = memfd_create("uffd-test", MFD_HUGETLB | MFD_NOEXEC_SEAL); + if (fd < 0) + ksft_exit_fail_msg("uffd-test creation failed %d %s\n", errno, strerror(errno)); mem = mmap(NULL, mem_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mem) { + if (mem != MAP_FAILED) { wp_init(mem, mem_size); wp_addr_range(mem, mem_size);