From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0960C332904; Fri, 21 Nov 2025 13:23:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763731425; cv=none; b=nQDKg2uoWmtFqEP0nXpY0siZQ++yvXoyCAf+jXig4mT1wC1lvMMGZXa44xX3GqFKn/XXp8koonxhoPjmyYhyE8S20Vo1LjklJDr+4c4fSC7Nl9ZIaLyIM/K0l+NI9Pm8fUiJdjgXyWDeT8241/t76fWzw1I/yoCg4z1YRLK6Tp0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763731425; c=relaxed/simple; bh=T2OTFISfSblVGjO95Zm+s0JHCYadv5KdXYds6FZ9tNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dQj/Q6mDXISBdjWWZrdKBIx4UwygeDnlZ14Wk5kpZfmIGD/SE7UHErUZxjJaZuWkI7SnARaPu6bdPNvDxMpQ8pphtoNMlAtuHyaCPWPQdKfJ6L3hn/wKduOdhb7Vv63itsKnGqfnminUz+g3W/2Li7xTt87iptcHhIAWe4nPdWQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wSkK7sAz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wSkK7sAz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B944C4CEFB; Fri, 21 Nov 2025 13:23:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1763731424; bh=T2OTFISfSblVGjO95Zm+s0JHCYadv5KdXYds6FZ9tNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wSkK7sAzulJN6UgbPkgE31juxSE0aXn+t/+hAAR4/arqRYZmv+SQ7pN5A/hzREF1h rJrTNq76SWhjc8mq+amsCk1n/i8voV1puKYYKXd2OKfrRESOkVrz5ybcQKX5d2kSJ1 SWbo/GS9vKdDJDiIXqq/kpzHzfz/e7VUMxQKW58k= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ankit Khushwaha , Beau Belgrave , "Masami Hiramatsu (Google)" , Steven Rostedt , sunliming , Wei Yang , Shuah Khan , Andrew Morton Subject: [PATCH 6.17 204/247] selftests/user_events: fix type cast for write_index packed member in perf_test Date: Fri, 21 Nov 2025 14:12:31 +0100 Message-ID: <20251121130202.046413676@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251121130154.587656062@linuxfoundation.org> References: <20251121130154.587656062@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ankit Khushwaha commit 216158f063fe24fb003bd7da0cd92cd6e2c4d48b upstream. Accessing 'reg.write_index' directly triggers a -Waddress-of-packed-member warning due to potential unaligned pointer access: perf_test.c:239:38: warning: taking address of packed member 'write_index' of class or structure 'user_reg' may result in an unaligned pointer value [-Waddress-of-packed-member] 239 | ASSERT_NE(-1, write(self->data_fd, ®.write_index, | ^~~~~~~~~~~~~~~ Since write(2) works with any alignment. Casting '®.write_index' explicitly to 'void *' to suppress this warning. Link: https://lkml.kernel.org/r/20251106095532.15185-1-ankitkhushwaha.linux@gmail.com Fixes: 42187bdc3ca4 ("selftests/user_events: Add perf self-test for empty arguments events") Signed-off-by: Ankit Khushwaha Cc: Beau Belgrave Cc: "Masami Hiramatsu (Google)" Cc: Steven Rostedt Cc: sunliming Cc: Wei Yang Cc: Shuah Khan Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/user_events/perf_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/testing/selftests/user_events/perf_test.c +++ b/tools/testing/selftests/user_events/perf_test.c @@ -236,7 +236,7 @@ TEST_F(user, perf_empty_events) { ASSERT_EQ(1 << reg.enable_bit, self->check); /* Ensure write shows up at correct offset */ - ASSERT_NE(-1, write(self->data_fd, ®.write_index, + ASSERT_NE(-1, write(self->data_fd, (void *)®.write_index, sizeof(reg.write_index))); val = (void *)(((char *)perf_page) + perf_page->data_offset); ASSERT_EQ(PERF_RECORD_SAMPLE, *val);