From b90119e3f3fadf1c049610f9cab969446843b3a0 Mon Sep 17 00:00:00 2001 From: Christopher Di Bella Date: Mon, 17 Oct 2022 18:15:05 +0000 Subject: [PATCH] replaces `sizeof(raw_context)` with `sizeof(*raw_context)` Using `sizeof(raw_context)` generates the following warning (which is an error in ChromeOS): ``` 'memset' call operates on objects of type 'MDRawContextX86' while the size is based on a different type 'MDRawContextX86 *' ``` This commit follows the implied advice of this warning and adjusts the expression. Bug: b:238678030, b:243982778 Test: Locally Change-Id: I26111c6ff7a1223223e6096a75ad52c48d941e89 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3960915 Reviewed-by: Joshua Peraza --- src/processor/disassembler_objdump_unittest.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/processor/disassembler_objdump_unittest.cc b/src/processor/disassembler_objdump_unittest.cc index 781b60ec..4b4ce6c3 100644 --- a/src/processor/disassembler_objdump_unittest.cc +++ b/src/processor/disassembler_objdump_unittest.cc @@ -147,7 +147,7 @@ class TestDumpContext : public DumpContext { TestDumpContext::TestDumpContext(bool x86_64) { if (!x86_64) { MDRawContextX86* raw_context = new MDRawContextX86(); - memset(raw_context, 0, sizeof(raw_context)); + memset(raw_context, 0, sizeof(*raw_context)); raw_context->context_flags = MD_CONTEXT_X86_FULL; @@ -170,7 +170,7 @@ TestDumpContext::TestDumpContext(bool x86_64) { this->valid_ = true; } else { MDRawContextAMD64* raw_context = new MDRawContextAMD64(); - memset(raw_context, 0, sizeof(raw_context)); + memset(raw_context, 0, sizeof(*raw_context)); raw_context->context_flags = MD_CONTEXT_AMD64_FULL; @@ -461,4 +461,4 @@ TEST(DisassemblerObjdumpTest, AMD64CallRegOffset) { ASSERT_FALSE(dis.CalculateSrcAddress(context, src_address)); ASSERT_EQ(dest_address, kAMD64TestRsi + 0x9999999); } -} // namespace google_breakpad \ No newline at end of file +} // namespace google_breakpad