From patchwork Thu Jul 18 03:10:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiapeng Chong X-Patchwork-Id: 13735977 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 9538FC3DA5D for ; Thu, 18 Jul 2024 03:11:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 253A76B0085; Wed, 17 Jul 2024 23:11:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1DCC26B0088; Wed, 17 Jul 2024 23:11:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A4896B0089; Wed, 17 Jul 2024 23:11:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E003B6B0085 for ; Wed, 17 Jul 2024 23:10:59 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 785F712083F for ; Thu, 18 Jul 2024 03:10:59 +0000 (UTC) X-FDA: 82351396638.10.EF8381C Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) by imf28.hostedemail.com (Postfix) with ESMTP id 571A3C0006 for ; Thu, 18 Jul 2024 03:10:55 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=sG+aDBk1; spf=pass (imf28.hostedemail.com: domain of jiapeng.chong@linux.alibaba.com designates 115.124.30.119 as permitted sender) smtp.mailfrom=jiapeng.chong@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721272237; 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=tgQJsXXJZtuIafpHz+x3BoFD/+zTuz5fz+02sw/hJ+s=; b=7ZqFlgwKYniDWIJkPEEN+mdn5qoMFX39ih69USpRwYtKR50WTM0BTh1Vyli8I7zVg82BJ7 1pvyJ1XTQrp2ajINL4e/GUI/OpqUZSEghMztmaCxzTa1YQ9aL5M3+gp9qAGgeDDdDUv7SI LcSLbj9JfOHca1Y+t0XnAJS+kAvl2xo= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=sG+aDBk1; spf=pass (imf28.hostedemail.com: domain of jiapeng.chong@linux.alibaba.com designates 115.124.30.119 as permitted sender) smtp.mailfrom=jiapeng.chong@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721272237; a=rsa-sha256; cv=none; b=V+qrTYMiHojieXRB2oEOLZPRihs7wF7MS3PeBTobMbVgZ0HLeRAML/OiVW9GcF1h6+DPYw mCcdGvEj0hHE/Nc0JVPuD3Cz/HqVR0KJ06gl3kRiS4W0LE0NGaa3WstlyrQfv31Jv9/dfn taS+KDWDYdTbAxgGZEL2T6QsPJ3M7Mc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1721272253; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=tgQJsXXJZtuIafpHz+x3BoFD/+zTuz5fz+02sw/hJ+s=; b=sG+aDBk1I9kvCMvEB8W6GJQAjGxDXh0yVWRTa6laPlGjLG9wCyVldtlh94K7Ou1KPVyOvWGBBF2RnBLQZHuudEts2BDtklL8AVFC7S9AJLCy/7smjlTVro7LBIf2lfeBzwuvJVE+0d8DKlen+BiVBvz8AUzzTQ+RS+Yjj7yLcdE= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067111;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0WAmhdTk_1721272240; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0WAmhdTk_1721272240) by smtp.aliyun-inc.com; Thu, 18 Jul 2024 11:10:52 +0800 From: Jiapeng Chong To: akpm@linux-foundation.org Cc: shuah@kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH -next] selftests/mm: mseal, self_elf: Fix warning comparing pointer to 0 Date: Thu, 18 Jul 2024 11:10:39 +0800 Message-Id: <20240718031039.69861-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.32.0.3.g01195cf9f MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 571A3C0006 X-Stat-Signature: 36cycwhhumrpobxeg4ugw8s1kqhnkpaq X-HE-Tag: 1721272255-924966 X-HE-Meta: U2FsdGVkX19q0HE97jXCUuYMhVuZvVkY4viemd8RZK4BpKN2vvIj+GfgkoAkQh8Sqk2f+l5eyEbtAh9FIlblLjfNXPFyOpM0ZT15mRhW0lL5RhAQPnmKyPJDIaW2SCHYEvdqDP6JjIQ0b8U2IRBREc1Of3u4L4rf4XvKA9/7ZtCvsx06jmdr42H77aDPsGWyI7/Q/5QJL6X+etr/0I5WW+mEEZ6dJz2uQiJRtsroB8k1Qk7VIUTPgPxF1Q2RqNj8iArT013Lo5WRbMsw+JpJJlyZcBIsx2WXj9poBYAtNb0yMOkZvgeLtalcqoMVd2wBiyXyUm/dg5G1pQMbVxWp4Xo4eYcq150dlIr/fIKSYdpSIxmgzxM9clvGi5YZybP7jYpIZYUC7Qj0c3rm4gnF+qRX0PD95khCYxHiBit+H+TkT/4hPWpGP+MXO8gBOoABKEgs/bxIYXtedKq7we3LWSZmgvgYq6ZhBTlPFwMYth4CH3IkUfs7jHK9YSwxw9pSA/WO6I50lesLt1Juub6xx/oXncO1ovbGSYM6x7eDRAjJWuO/vQyq02Ms/zl/USuvOPk4aqu+HQ546pLbe12OwfhAc72nnUvrum6GT97za6RUBBE3QFizk3z/56aG9MySW42Pk+ywT7Oz8K4L+MJG3RUVCPwE/aOHiEK29d4u4Wk5MO4i/Ovvw8lScaTWp7toTxElwpF1r21p++1I6tRagPY9FU32amnyOfyY/hiGOmlZxhf1SROwVP+v1cczKlNoC/wjeAqjlN9WneCngsSO8zZJo990+mZDzyi/9knuGQLlxkQlKkS2IBUbh/FpfojEH8jz90pORCU2RlPJMi4LCaiLjP3RJMJH8VtCH7dR6FJcBvW3jYa+s0rppZYDfznYajms3XF01eJE5RMpvjDeqPBmOKn19KVQ8ev42hvAosh1T98ZJuKAjIYtGTyMjnjOyFRBbeYbyak2qBA54VT hq0HovLZ ddWijbReg3HEfirOv+jpNohW1oou7SC8uxkH6UoKjcnGUXvBeLlFYV4FF1twzNAwjIasPrRpCU5X0JvVH7tYBxQWm3FR2Q0JkDmwUUu/cI6v5+EVi8fTVLVYJFJAnc+1YmNt49qLN8/TlKUg48I8H7vFNxHZ18NJ87sHXZjFPkLkq5lCL/Jqja67piZBm1+dL5f9pi4DxuATF0AuJKrKzZbKPBFX9tUEC70iHard18Ty4GGGVndK+OR1NimTR5ImoH0pf77Db6z7gP9I+aIZNTuY5t+eYUTX3m25+BhEL63kPkFy/7c58RsI0xLZ1FjYxbyBXpGhJvfnqPMs= 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: Avoid pointer type value compared with 0 to make code clear. ./tools/testing/selftests/mm/mseal_test.c:486:27-28: WARNING comparing pointer to 0. ./tools/testing/selftests/mm/mseal_test.c:1399:29-30: WARNING comparing pointer to 0. Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9552 Signed-off-by: Jiapeng Chong --- tools/testing/selftests/mm/mseal_test.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/mm/mseal_test.c b/tools/testing/selftests/mm/mseal_test.c index a818f010de47..50a5b9b9399e 100644 --- a/tools/testing/selftests/mm/mseal_test.c +++ b/tools/testing/selftests/mm/mseal_test.c @@ -481,9 +481,8 @@ static void test_seal_zero_address(void) int prot; /* use mmap to change protection. */ - ptr = sys_mmap(0, size, PROT_NONE, - MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); - FAIL_TEST_IF_FALSE(ptr == 0); + ptr = sys_mmap(0, size, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); + FAIL_TEST_IF_FALSE(!ptr); size = get_vma_size(ptr, &prot); FAIL_TEST_IF_FALSE(size == 4 * page_size); @@ -1390,13 +1389,12 @@ static void test_seal_mremap_move_fixed_zero(bool seal) /* * MREMAP_FIXED can move the mapping to zero address */ - ret2 = mremap(ptr, size, 2 * page_size, MREMAP_MAYMOVE | MREMAP_FIXED, - 0); + ret2 = mremap(ptr, size, 2 * page_size, MREMAP_MAYMOVE | MREMAP_FIXED, 0); if (seal) { FAIL_TEST_IF_FALSE(ret2 == MAP_FAILED); FAIL_TEST_IF_FALSE(errno == EPERM); } else { - FAIL_TEST_IF_FALSE(ret2 == 0); + FAIL_TEST_IF_FALSE(!ret2); }