From patchwork Thu Aug 22 04:46:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Zhen X-Patchwork-Id: 13772656 Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010057.outbound.protection.outlook.com [52.101.128.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48D4450285; Thu, 22 Aug 2024 04:49:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.128.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724302180; cv=fail; b=VzwkzfhJT4NB8vni7iAsBLzwNaP5kYMOAi5VogpFj9u0ST3iziH1uOj87mmDH7bvXtqVSMojE0CEx95Ykq3IA/JxgtOWZcb528mfConhXw34NYEMyazlXvFhXS7xFD0YaGMKUwnwDcXpTEtFhNnZd8Ho50WR4JzWKI2HDqgzdME= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724302180; c=relaxed/simple; bh=IWA21qsBqUWOiEICwiJeEbFuQzNxsSLNIW0L7imodD4=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=lvWIBGd8xmXZIA2I43IPIVJcfk1P6LrwbhtzvfjDvnoeC5Zcqb6jieWvLzw1R8Ix/yQLj06tgvZ+8kpGfojhnhgQZc0idqXxsUht1Z2jpziwgae/lTPGHv++z5ACFyiS2Ebn0be95mvRpTmDRINavaYUdT4DDokdJHnJQad8V3o= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=Zkj9TQn3; arc=fail smtp.client-ip=52.101.128.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="Zkj9TQn3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pXksFJ7hZFw5C8RjKBuQ1fIcUR5nHwgHXR+K9QO5ROY/RdcjraEI/T6XTjvXdAciuZcB9LisIfqC2bs9GOoMXYtsayy+TuPblbqNgAByYYJr2v7mE56faSw9WGEWt2XAceXVNbLlGn+n69hQmW7uZktFL/OQN9vdbzt0VJCqgtKy1xUe9pp2rGTostrDcceNGfWkxg9cHClsr62RUz/lm2owVk7dvMwKOuQs3TYKdi/JV6zD+mxnOLAGGsmR56N8YmyMFMlZvUvaFXfAV5Ht6X2BWbcr1zKYPbq5afGGeadqDdB62eZ+++VmOUhvjNhQ7Qpnf3BIp/+mT+Xi+UqXeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sNODIU80C6+0bqcCnslgPI1vkrfbSCo0VFk8SJiCxGc=; b=c5itozSBXZfLe5LZfwUSFCXj5NV5hUWKMT1r45ClgXMU3QJRkVBSW4A8z+KCsynpsRWLICCrlI1rXpo/N9h5ygko/JttfK3yx50pFeiYFfzPqblDIO2H/Jqngpy7FunrQELaZMivxfREenWevoqL0Ij/NWAK+WnQxPEGvyxVnjb9AtvYf6dE70Kan/nV/T6I8C0Iz25QbYIDm2e9X/X4olAvjfi1uFpZBmMosGoikgQ1J0z4h7Ee0bG15pzlNzdQkGLhzOv4RDFEhKKU5WCrYy5tLfR4Vh0aIrv/NOgiXeG7dW03+/ja7wHWsxP1ywY2WoDWFFdSlPPpPWIWeipKZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sNODIU80C6+0bqcCnslgPI1vkrfbSCo0VFk8SJiCxGc=; b=Zkj9TQn3/J6owoR2G+Hos7ng2PGZEzzzn3pk1PiETcAQ62BvnDwiXWx+VWO5RLdoj0c7ZlBb6WClLdj5DTTQf2mLgTmKQ+0G6sTy5yfl5FMMXZ0lBGsmlD6Q9HJ9an1N8R16VNeBWAxQCK9ma++vbrjq4XlEWbviaChwTibu0sHOkhH7gM5z8m2CAvF4po+4mypLv2A8gjAlEhL7KMy6TTrtW1ATdPQqR3vFCgKEmd29Fss59/6qknYuXLFoDHR8eCD3h0laz5AjEsZNFrnTpJMQiWyLpbIP1cTnQsHPedoqRriYwyewN8yJo0CXjw8yFUl+xt6DTj3jUey0bhlPwQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from KL1PR0601MB4113.apcprd06.prod.outlook.com (2603:1096:820:31::7) by TY0PR06MB5658.apcprd06.prod.outlook.com (2603:1096:400:276::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.19; Thu, 22 Aug 2024 04:49:34 +0000 Received: from KL1PR0601MB4113.apcprd06.prod.outlook.com ([fe80::7e85:dad0:3f7:78a1]) by KL1PR0601MB4113.apcprd06.prod.outlook.com ([fe80::7e85:dad0:3f7:78a1%4]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 04:49:33 +0000 From: Yan Zhen To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com, Yan Zhen Subject: [PATCH v1] selftests:tdx:Use min macro Date: Thu, 22 Aug 2024 12:46:30 +0800 Message-Id: <20240822044630.1267500-1-yanzhen@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2PR02CA0041.apcprd02.prod.outlook.com (2603:1096:4:196::20) To KL1PR0601MB4113.apcprd06.prod.outlook.com (2603:1096:820:31::7) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB4113:EE_|TY0PR06MB5658:EE_ X-MS-Office365-Filtering-Correlation-Id: 669922e7-4387-422d-e018-08dcc265d0ef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: ixrzM79Mj/mmGbtwl+PMAqyTU2RMMNkm5MqKJg3XX36fYvUzmVy+7xt87qJPSXVMSRQ+ZQAnPMZUyTK1E3D6+FIv/vBIzHhqieBHgDw1npcuY5stM7bEh6r2GFJC06isihhLwEht8bSV3Fl5nfw3g4jj8gBtswHybH5rOLtQovpSb48Ep73Y/2u92mvutgHkgjx2DE7riqaGAqvVCFuOgChh/dBQ26K2gwTT4LlQQfg6SOqBC+/LF0ukPrED0vSj8+8TFMLl8+5XU0L9wePOM0kXrTFr4RbJV/E7iYj9r/sTj9u+EvIo4v+xXo7CaEGJFSWeqOoTgfG3L+xgns/B2vip0Nn9lzDhIRyZMwc41c0GFJt1PpAuMiCPQbIxWTINqF3A+fS+NMirJ59uKmleD2HMb5M7KhP4Pf3dNicUfTa3qPErZ31m0UvIWLR5BsaKfdEWMm1+YYc8HwZbqbRW6LeQCJDqNSeMwv+SsS0UmtDV2aLfrPpHe7da6WLB4Y+gB+4z6sTMWGnt1iRniHHKAerVhF60F7gcjK07TBIV6gOc/IkovitTe4wd6UTbQTYXooLbCsO1mc5vvgQWdEU5m6RKvk53a14AjWnvOYkPajU9cfLZJZdNqSu51ImCKZSxt5fOjRVDB0ysss+MV5NZgU214tnhC6N0svRuBhzM1c6m21WTQILueXK84Jo3BbazeDX6AYlOyKMxgc2TFeIYugPW7enq6iTBODuyiKTp/yfyhe4lQf0+gLTtjEmLrCTd8BFz4tG81rMloORst9qm/xOLMtZKdqsXvM6bHFdL9OTEbMrsgelrzVwOYGURzxGEe4bT98wTd/OhZ65XK4+0m74STYKTOfAs78YYP60diqmSa60RvY5ORV/3xDCzlbF6jXbme1yogqvIwIqAKYaJjECYmlMthTU4BYdwxggx6jUQ/j5DmmUJPnmXlqG4SaCBKL6ozWe1zV+EWXDwg4qf3z76WgY5JeDXBDs2e03RAzSidC4ZkIUcepFiPMGvENK2rIt5NSCdqB2mN193QvrnpVOuJGhigqQD45cM14Rvi87iHW8x6YPq1OI5KG6q3J/mBqiE1LXVxjqGDFfqm2mW5FW71jdpPDCtBSthw318IxdH8ni689jlICV7jM9dRv/0miEMVkWl2lc+Z0NVXHxr2s+eeqGfaZK+cr0JTyH1gTtirSfY8iAqGGVbB/LfnkCdn89g3glLUnAEEL7RvfND/Ogi7mIbiC0qPRcw+cRSS22pD/Tq6V/VNBq1TeHG6njpAjFsXQl7YDPPRVucToKMXisXkTgUriFo2OJgQE234X+9PoboxvVxVIpv8jOBjiCe1uKJJUAIPPCugNVxDeD06hrBzTjwNcXhqKr3KYvJy/quXQqfM8i2JRmC8PpKRqf0AHEY+6m0ZwYxwamqh+LYBw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:KL1PR0601MB4113.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(366016)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: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flkBzky7MrvP80pB4z1uKL0RvjLmZQyvhCCMjFg+DBx4kjke7v9A0XSjTh97ZX7bZLxJLZH0kNfga86dkUNXPYYSZFVsKOnzdF6IlQGwtt2mT7brnsyzAZLmmNBtSvmZg4h5dDIUX1ugC6OWBUHfVZwDNRVnufKrWoNjkwyWj0j8kqVFQk9lPGFWNNmN4l9BN8qETX+5Yi/qo4/iOo1xdD9TOhw0C9ZZdbF3y+fXIA10NivtNKL8037KesL9kkjKKBfefUz2UanE4byhZEUL70+huaWb+cjJJjujfKO73802fi22xa0/P23FEe+dTbWmtJJKt24Sx7bRWls+qKVFeC7atiO2yBJJQTjYKEMeSzdoqqCCrSCoseRPjdlPHPMsBDm0lr3vo6dGlzBX3eMm9sGfEt2GInMAO8HcNkVK5lVBS9BXnJAlyH/Kdjh5Unjhc3BSOcvKh3MLuwwkKJ2xwFgzZr5DQZPbZxQQkEBTTZs5phCwakQth/lLWTOn2p36bF8PQ2Z9P X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 669922e7-4387-422d-e018-08dcc265d0ef X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB4113.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 04:49:33.4648 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AhoP9Z7FOR4Aobn4dboN+0F7os6B1FXmXBpV1qYAUXvUVWqYAsdGD4m85gXqz6+KtoW12G+fb2/PCMshPf9oPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5658 Using the min macro is usually more intuitive and readable. Signed-off-by: Yan Zhen --- tools/testing/selftests/tdx/tdx_guest_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/tdx/tdx_guest_test.c b/tools/testing/selftests/tdx/tdx_guest_test.c index 81d8cb88e..d7ddf5307 100644 --- a/tools/testing/selftests/tdx/tdx_guest_test.c +++ b/tools/testing/selftests/tdx/tdx_guest_test.c @@ -118,7 +118,7 @@ static void print_array_hex(const char *title, const char *prefix_str, printf("\t\t%s", title); for (j = 0; j < len; j += rowsize) { - line_len = rowsize < (len - j) ? rowsize : (len - j); + line_len = min((len - j), rowsize); printf("%s%.8x:", prefix_str, j); for (i = 0; i < line_len; i++) printf(" %.2x", ptr[j + i]);