Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2130072rdd; Thu, 11 Jan 2024 23:19:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+Hpp+ncCZXIjLyCsLBE0FfLY8t5DQEtz52eUo0kYZLoomVxRXu6sgzISsAYUx/J8wCSzT X-Received: by 2002:ac8:7d50:0:b0:429:ca07:3c51 with SMTP id h16-20020ac87d50000000b00429ca073c51mr1027514qtb.64.1705043943795; Thu, 11 Jan 2024 23:19:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705043943; cv=none; d=google.com; s=arc-20160816; b=Pe+TNOcY5ht1Z7NkztjytBE06A8S3oMKK50BMFB301gt0PrJYbaSX8KEnmTm1Q1WYC QwrRBV077jA1tDikk6dfv15/qaDnMFOh3xb/gissugamZY/UQvX5bI5LB1oUQeH7Ccbd EFaw+36C8VDJqOZJirx/kWjY+x8T3vWbXn21ex5rxjLzv0XjGOhLloSO2pDUMjtPUKQ9 2xuhXC0XDAqD1e6l4e4Oj8RrLD07c/ViM+chl5epKlbbpPRsBWqxOPMD+KChRsJiKU36 flFY7h6qJKY2DY7iWu3xzrCmiwi/2edTwNSGomKXfcyVlb0wF8fsI/Ng23W23RZfAyAk QbKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=yyfusRgp1ybFVCuSZD74k06I/6/0+ITx2+/l0LHEjSU=; fh=k5L2LUyhJCu8KGwTGKt38tLjctZn3Wq7HuLySfvQIJA=; b=PyhsXCnYTZGwpw6MQh5kxN8upSezJjBPIwfK3YhZVNm3fXME4FtwRq+STd4CZW7Hyq mhVPS4nGI4hGAKG+LBrk3RpaOKcBym306SRy1RoQZGQ/ndEuyjAhdgQ/iiBmFU5svfGU hF+m9GmZmC+NVlsbB/Tb6DtYJnDlCXsukx+MFNYHjRSkGxGt2WUMcjGjIjm9TuxpdPWx eKhzQUIbS/vqqbO5zUNyXNoE1u/wXGcbGGEDyQ8iFBAOsiX3DTpIu53nzq6ZfKa+4s+z 2iBhUEq6fBBona2XnKhIxKhIBrECbYYbmghVJ8w3qWRTb4uxDwnLi/7gTw9BkNI3mnoA 3HeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=mpZdZsKZ; spf=pass (google.com: domain of linux-kernel+bounces-24363-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24363-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 16-20020ac85750000000b0042815203583si2524280qtx.144.2024.01.11.23.19.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 23:19:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24363-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=mpZdZsKZ; spf=pass (google.com: domain of linux-kernel+bounces-24363-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24363-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8E0C01C244A2 for ; Fri, 12 Jan 2024 07:19:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A92F5C90F; Fri, 12 Jan 2024 07:18:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="mpZdZsKZ" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 377EF14F66; Fri, 12 Jan 2024 07:18:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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; } -- 2.42.0