From patchwork Wed Apr 9 09:50:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 879948 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04FF625A2DC; Wed, 9 Apr 2025 09:50:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744192226; cv=none; b=AZ3J0NUoJdGbc2nV91UyzFU8Cp3Bpzti0fFWAIeEgjoYPARpx4nYrbciUYZBX14LGzVk20k3R4YVdDRoWtYJ96e977SDh/BAtHHixPwxrYCvCcShzY3Q5jyxvU8Wx4zaPb/j6+nrjnBl6swqDanz0nAfSgCSxd6WEy2x8U9AUEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744192226; c=relaxed/simple; bh=djv4e+40pLsB+IrtUJHHfQeXkTy4AFV6Uvs67CoZRFk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=EAfd7osSj266QSsiDlvHSqwCIPrtiLpxxT5t+xGyOKJL1xcgjlwP8NJ766KUOrpkQy5sGO51VHTob8hF7gboAwhnlL0T1NCtciKcx7bLdmjBvh1+PvVKhvKK/zw1EUSJQNt7zEVZRVLDKvurwtm8YTWWWMMXFahtI5Tw9GehV3E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 76DAC106F; Wed, 9 Apr 2025 02:50:14 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.42.12]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CA9EF3F694; Wed, 9 Apr 2025 02:50:11 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org Cc: Anshuman Khandual , Andrew Morton , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] selftests/mm: Fix compiler -Wmaybe-uninitialized warning Date: Wed, 9 Apr 2025 15:20:06 +0530 Message-Id: <20250409095006.1422620-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Following build warning comes up for cow test as 'transferred' variable has not been initialized. Fix the warning via zero init for the variable. CC cow cow.c: In function ‘do_test_vmsplice_in_parent’: cow.c:365:61: warning: ‘transferred’ may be used uninitialized [-Wmaybe-uninitialized] 365 | cur = read(fds[0], new + total, transferred - total); | ~~~~~~~~~~~~^~~~~~~ cow.c:296:29: note: ‘transferred’ was declared here 296 | ssize_t cur, total, transferred; | ^~~~~~~~~~~ CC compaction_test CC gup_longterm Cc: Andrew Morton Cc: Shuah Khan Cc: linux-mm@kvack.org Cc: linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- tools/testing/selftests/mm/cow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c index f0cb14ea8608..b6cfe0a4b7df 100644 --- a/tools/testing/selftests/mm/cow.c +++ b/tools/testing/selftests/mm/cow.c @@ -293,7 +293,7 @@ static void do_test_vmsplice_in_parent(char *mem, size_t size, .iov_base = mem, .iov_len = size, }; - ssize_t cur, total, transferred; + ssize_t cur, total, transferred = 0; struct comm_pipes comm_pipes; char *old, *new; int ret, fds[2];