From patchwork Fri Jan 12 07:18:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13517999 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 423FBC4707C for ; Fri, 12 Jan 2024 07:18:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CB40A6B009C; Fri, 12 Jan 2024 02:18:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C62E86B009D; Fri, 12 Jan 2024 02:18:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B2A396B009E; Fri, 12 Jan 2024 02:18:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A407F6B009C for ; Fri, 12 Jan 2024 02:18:57 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 74CAB1403F9 for ; Fri, 12 Jan 2024 07:18:57 +0000 (UTC) X-FDA: 81669807114.27.ED79293 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf18.hostedemail.com (Postfix) with ESMTP id A99061C000A for ; Fri, 12 Jan 2024 07:18:55 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=mpZdZsKZ; spf=pass (imf18.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=1705043936; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=yyfusRgp1ybFVCuSZD74k06I/6/0+ITx2+/l0LHEjSU=; b=ZhXVc9zF8rhVJTrL9RER3sCvNV7/h/AS1a8aQE7ohPqg9uneLndYkzZOKkuOQX6gEF8I0E zxDfQwMJulXxPrPm/2w8Kz72onSOM26qhFhvZj7kVpszpMN2anMEwJysDWerCu09hzcAuf WtT7/awqyhc4eVz4S/phGZ0xIaHfhGs= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=mpZdZsKZ; spf=pass (imf18.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705043936; a=rsa-sha256; cv=none; b=hXFQ6/z8bN7IN8Y3atKs+xTNm+4sRNXrFr65zuUmB2CnCAl7B6KahZrJo8t7d4Y7AE5VM8 IVWR6OUb0FXuCGlGGL1NFyJB58gstkLBfIKFiHYbXr6ejC+nVaMlJJHFMqEH2UuVKmrJg5 gM3UnYr0IL16Tq3BZWxe/XE0Qbyk+U4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1705043934; bh=1mGvbpuqwHtoANCV1zxPQROR5hRRyjn81bfXlsqdtlk=; h=From:To:Cc:Subject:Date:From; b=mpZdZsKZk1liMVoBMl9BW48ImM2eycPAcD60OJjUCvQlK3yBVJH7Z1AxTTSwLxwgG E/cHfULVXqZ4C1/JgmbhVPlaRJmmU5XZMgk0TLQKTI8hSrHf7Tlwm2mgVb7uIXua+o naGk5SJNSQ51SHcMvQf8Qn1lBNshBb0v47m7x6sf/3D+oKsw9M5gr7cG/hZQ0UHL0D iRYuwEmRUdJ5A6x7ejfGt1APvGNaQa1GYqmoCANhv4NlWcKyHsK9Ad2m48lQOZnBRz mTXEkc0w88Z6x3owMRt/VMPlqyjk9jq9KlcZrRVzFZxNbrMrnOHatbqFqDz6ZnxIuz LzXSn3s017cgw== Received: from localhost.localdomain (cola.collaboradmins.com [195.201.22.229]) (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 15AE73780894; Fri, 12 Jan 2024 07:18:51 +0000 (UTC) From: Muhammad Usama Anjum To: Andrew Morton , Shuah Khan , "Joel Fernandes (Google)" , Lorenzo Stoakes Cc: Muhammad Usama Anjum , kernel@collabora.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] selftests/mm: mremap_test: fix build warning Date: Fri, 12 Jan 2024 12:18:50 +0500 Message-ID: <20240112071851.612930-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: A99061C000A X-Rspam-User: X-Stat-Signature: 5jp6pw3aundaecai77685nyk9wdyepm3 X-Rspamd-Server: rspam01 X-HE-Tag: 1705043935-697929 X-HE-Meta: U2FsdGVkX1962HBEF0nmGXSnQyZ7n/smZfQ+3gM/AmHcMSTnZv/t6E7giJGoPzndV0LVdjJqK1AV4RULkPxWkrMh77qFP6cIATP6yzzhphWV53UZTgfW8IjjYND2nkUCopk9Ovz8hdkE8uv6bKbymvcCnq2suVCwc33FpXJ8ra3xj6VPsNFoRONIykovKktvIQsDluTh/XOVvQ41KeXMt3FcxDPXjyMVBKcRrm1XAqv8f/hkdFGdIgn1DeQsETL2mXUTrwwSxs/mcOj/SmW8EP6FCVmrIXBly2D9jhmuVsz5TviGQVE/YeHtN6m1/1a1trfcLUOU8W/ZnO60tYf0GsnHwzu8lR6wDCX6wSh96xqYV0DcDZZlW1wbPTWg3NkgEhpHYwksixUQeqMwKZs/5HMd/BuBgHBvCMMHq1CnxlzAApLa97BpCBsrR2rsTZ4RkWBKSm9Qs9biws3hqmCPFHyrjITsvmSHMMKZSPFjtWvT/e8/Bt8U2a5usEoKhojkkbnX2Q5SEags1S6gOPPXxIZo2gb6vrrBMT4ofsYz8c1r+E0fdaHDRTQPfWhr4JR7+sE41qPNiW3eewQXqilAFSBp20z1bk1Lo/1u+9SKhmqQzFRAYmBrPX8iWdnGcUoBQN3GAzoS2wrA1l7QMVv9v3BkuMzUwbkWMhMt6HD5vxfkNhG3pw9qnckFRvaQMNnFnMVy1Pc9licLmXPVIKpMf7jKTbj194nvhbyjLk3YgdJ8eDxEcRwd2z/hSKwlsJcaPjqIgy63iBkWgyd1ff5as8tj323K2C2CKq0FtPJzizxGR2Xq8QERhog/53xbEEsRpaOdePakKrHSxMvBdpxW3diIqrqvWiKx2zjMcpza9CU4bk7mINHVnmMuSCdfl1RZHIpfDFkowtg/RMoqJ43z5cwL1xXxd0KYu8sFnJ/3xUCgG0BxRfo+w7By2P3a2wbvyVrbNuk/R756lXmhMHY H7jUnnxe PV+JZmsWQwtEgoN9b/VrwkLLGau6kxO//3Vo1va7F13krZutnJ6zgdUNtEGLW6hlViPRQlff3L59pcHUuW3G/vOBhwKXvW7wfbMCwboNGRKh7GFZs4iknpL13ITk1GK1y5MNIRRuoHa/XdgUgjX3O8Qjonl1EnBTf4THhDo3OSR4BGIlKiEAOLDVVEoZDoq8FQhpUySiWrh04M6GOv9Wbdq3yB2kNwDZYt7diHzfILIlexAeAmIDqL0ryYUqFT0/s58A6gGPfxuoblX3HCPzpZjbbFeGC9ltv61yIlAMl6GhKRqfXkzkKjC9Eqw== 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: Use 2 separate variables of types int and unsigned long long instead of confusing them. This corrects the correct print format for each of them and removes the build warning: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long unsigned int’ Fixes: a4cb3b243343 ("selftests: mm: add a test for remapping to area immediately after existing mapping") Signed-off-by: Muhammad Usama Anjum --- Changes since v1: - Don't just fix the print format, instead use different variables --- tools/testing/selftests/mm/mremap_test.c | 27 ++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/mm/mremap_test.c b/tools/testing/selftests/mm/mremap_test.c index 1d4c1589c305..2f8b991f78cb 100644 --- a/tools/testing/selftests/mm/mremap_test.c +++ b/tools/testing/selftests/mm/mremap_test.c @@ -360,7 +360,8 @@ static long long remap_region(struct config c, unsigned int threshold_mb, char pattern_seed) { void *addr, *src_addr, *dest_addr, *dest_preamble_addr; - unsigned long long i; + int d; + unsigned long long t; struct timespec t_start = {0, 0}, t_end = {0, 0}; long long start_ns, end_ns, align_mask, ret, offset; unsigned long long threshold; @@ -378,8 +379,8 @@ static long long remap_region(struct config c, unsigned int threshold_mb, /* Set byte pattern for source block. */ srand(pattern_seed); - for (i = 0; i < threshold; i++) - memset((char *) src_addr + i, (char) rand(), 1); + for (t = 0; t < threshold; t++) + memset((char *) src_addr + t, (char) rand(), 1); /* Mask to zero out lower bits of address for alignment */ align_mask = ~(c.dest_alignment - 1); @@ -420,8 +421,8 @@ static long long remap_region(struct config c, unsigned int threshold_mb, /* Set byte pattern for the dest preamble block. */ srand(pattern_seed); - for (i = 0; i < c.dest_preamble_size; i++) - memset((char *) dest_preamble_addr + i, (char) rand(), 1); + for (d = 0; d < c.dest_preamble_size; d++) + memset((char *) dest_preamble_addr + d, (char) rand(), 1); } clock_gettime(CLOCK_MONOTONIC, &t_start); @@ -437,14 +438,14 @@ static long long remap_region(struct config c, unsigned int threshold_mb, /* Verify byte pattern after remapping */ srand(pattern_seed); - for (i = 0; i < threshold; i++) { + for (t = 0; t < threshold; t++) { char c = (char) rand(); - if (((char *) dest_addr)[i] != c) { + if (((char *) dest_addr)[t] != c) { ksft_print_msg("Data after remap doesn't match at offset %llu\n", - i); + t); ksft_print_msg("Expected: %#x\t Got: %#x\n", c & 0xff, - ((char *) dest_addr)[i] & 0xff); + ((char *) dest_addr)[t] & 0xff); ret = -1; goto clean_up_dest; } @@ -453,14 +454,14 @@ static long long remap_region(struct config c, unsigned int threshold_mb, /* Verify the dest preamble byte pattern after remapping */ if (c.dest_preamble_size) { srand(pattern_seed); - for (i = 0; i < c.dest_preamble_size; i++) { + for (d = 0; d < c.dest_preamble_size; d++) { char c = (char) rand(); - if (((char *) dest_preamble_addr)[i] != c) { + if (((char *) dest_preamble_addr)[d] != c) { ksft_print_msg("Preamble data after remap doesn't match at offset %d\n", - i); + d); ksft_print_msg("Expected: %#x\t Got: %#x\n", c & 0xff, - ((char *) dest_preamble_addr)[i] & 0xff); + ((char *) dest_preamble_addr)[d] & 0xff); ret = -1; goto clean_up_dest; }