Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf intel-pt: Prefer get_unaligned_le64 to memcpy_le64

Use get_unaligned_le64() instead of memcpy_le64(..., 8) because it produces
simpler code.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20231005190451.175568-6-adrian.hunter@intel.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Adrian Hunter and committed by
Namhyung Kim
661ce781 3b4fa67f

+3 -3
+3 -3
tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c
··· 190 190 if (len < 11) 191 191 return INTEL_PT_NEED_MORE_BYTES; 192 192 packet->type = INTEL_PT_MNT; 193 - memcpy_le64(&packet->payload, buf + 3, 8); 193 + packet->payload = get_unaligned_le64(buf + 3); 194 194 return 11; 195 195 } 196 196 ··· 302 302 return INTEL_PT_NEED_MORE_BYTES; 303 303 packet->type = INTEL_PT_BIP; 304 304 packet->count = buf[0] >> 3; 305 - memcpy_le64(&packet->payload, buf + 1, 8); 305 + packet->payload = get_unaligned_le64(buf + 1); 306 306 return 9; 307 307 } 308 308 ··· 341 341 packet->type = INTEL_PT_EVD; 342 342 packet->count = buf[2] & 0x3f; 343 343 packet->payload = buf[3]; 344 - memcpy_le64(&packet->payload, buf + 3, 8); 344 + packet->payload = get_unaligned_le64(buf + 3); 345 345 return 11; 346 346 } 347 347