From patchwork Thu Feb 23 23:17:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 656012 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp600795wrb; Thu, 23 Feb 2023 15:18:42 -0800 (PST) X-Google-Smtp-Source: AK7set+52/79G9FwyYZMZrszKdQ+uJGit6s5MazvyPkZvvR9ne4aH3WKn2pnWDvU9pDabW6bZkBs X-Received: by 2002:a05:6214:d4d:b0:56e:b21c:61e5 with SMTP id 13-20020a0562140d4d00b0056eb21c61e5mr27073959qvr.47.1677194321954; Thu, 23 Feb 2023 15:18:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677194321; cv=none; d=google.com; s=arc-20160816; b=c+J0UggWUvhi50wIkehx8p/VqhnjrTXWF3HhbP+9SKu0TgAb6xyzojYV8hki7T3t6b aGK6yo8cBzrfzhMRHQgB/yq5UVa0Ja4BGA+uLslsWMIP3nmIx1tKnQEyphu4Dc6xKMFH TzhSUMgUlApZal1VbYmcPAECnHtWwDCJ45XFIQqo83l9S13SsUd5ReFAWCiZ4jZO/wr5 z4gmuUlk0Hur65E3NXR3eL32us5pd4J+kTXMQMnAQqt5Mcg3ZF6zFfIbc8hH9BZG0HJV v9Mfc+RCVik0OvAy6BWd+ahp0z9Q29saj4/fCgiHujwINMgsG8LKN+A8ooU6FnCJ/rII o2sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wWu2Li0HdtRyVbKb/qvrvVuTsZ+F9Z5D4ZsK6YGQoVI=; b=A3k0UIuVgLqjnxk/MMSvqJIaHcoim8W+l46wc4AKwff5VZMeJv5+BrdzO62uZB4ZuK 8n8kSATY0pL8b1Lu8gVo+fkMqPYU8Hc0MyL3oQO0QkJdBdz9B3gSQ5367AmDWVm85fyk XzyVv2f8I/NgHpwT0tKvfOFwIs5Q7Shlyfe9KVzSnTdnNrDRA9kwbQRUVyEdMoVbrzQ0 mmoEclG2iu4TT2XCPtj22aikTNZ5/zL7uU/dR4rk2hscwLd5qoKivwwP67RucFAfdhI4 6Ia7JSyCzYBSPDakb+35Io94Nrtjw7TTWNvzPGTw/G7U1d+3v8ElN6LrTqwC0K1wmp47 GklA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lj9M2Maf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y9-20020a05620a25c900b00738e842891esi1939062qko.560.2023.02.23.15.18.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Feb 2023 15:18:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lj9M2Maf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVKqm-0008VJ-SO; Thu, 23 Feb 2023 18:18:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVKqk-0008V9-EP for qemu-devel@nongnu.org; Thu, 23 Feb 2023 18:18:06 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVKqi-0000Ry-TV for qemu-devel@nongnu.org; Thu, 23 Feb 2023 18:18:06 -0500 Received: by mail-wm1-x32a.google.com with SMTP id az36so671649wmb.1 for ; Thu, 23 Feb 2023 15:18:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wWu2Li0HdtRyVbKb/qvrvVuTsZ+F9Z5D4ZsK6YGQoVI=; b=lj9M2Mafl9UAuQ3IL09b432c7nvJHA2y5nfxlSA1rbHRGirABBZ0l7XMN6OKxjZ6bs HZKk+DnUDoVp6z2q6TM/0inCFB5awJAtiVLkaO60R58+o29kVYDrxPW4fFMJKFQ9am6w 69hXBDMLhQKj3zG6SYCOhCXchNcdLAUzFMGsXc1JZEB0ddBatQUJ+C6ocCQWh73Ad1BF QfwXLVUx2tA4ZDvwxbhqjW4D7uAugp+uZUy8SfKSf2MDzkhQVUKxAaWxfFa+Gtt0C2hc 6pQ9I8acWpW7E5hHQ6fVW9gEqcXKRgjP88geZeAmM1AdZsyuWM281xMQeK1cCoaSdVEu ox1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wWu2Li0HdtRyVbKb/qvrvVuTsZ+F9Z5D4ZsK6YGQoVI=; b=C1v/L2OrqbJnyTVAOqlC61Yuln6cGe6oOidKeWY0wE1zModNud+WMdV5xhaEH4ZHoV zvsaLHQ0Avx061ig8Ce4qU1IU15G4iI8GrsStGeRAl3vd9SRQhgUqWNkTkdiuCKZwRB4 Ff2KyyO62f18y860nxuLimPJljrTNePZp1d/m+Ruc1mOfzTlI2AzbEPERXYrNysSr//a XrzClewJV3W4YCZOz+JSEFs3IUcudbjzvG2JXq/G/g8368WBVoyt/3zFb8IfseW9acvz 2zvM0Qn6aU79rcxMcDjIUHUNo9yIhdXZDQ216T5dXyhanspU9xId+pPyP76VhEvu2B+d 49bw== X-Gm-Message-State: AO0yUKWaXq74pHSbqv4bqAGMkJrLRKNkM+8vl2T/tF3zq5tYiLU3WIyx TztWpo7bKZvhPcox+QRjzYJ/VBEqZmc2Vzn5 X-Received: by 2002:a05:600c:30d3:b0:3d5:365b:773e with SMTP id h19-20020a05600c30d300b003d5365b773emr5351712wmn.39.1677194283002; Thu, 23 Feb 2023 15:18:03 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id u16-20020a05600c441000b003eafc47eb09sm571786wmn.43.2023.02.23.15.18.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Feb 2023 15:18:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Janosch Frank , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , =?utf-8?q?Philippe?= =?utf-8?q?_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v4 1/7] dump: Replace tswapN() -> cpu_to_dumpN() Date: Fri, 24 Feb 2023 00:17:49 +0100 Message-Id: <20230223231755.81633-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230223231755.81633-1-philmd@linaro.org> References: <20230223231755.81633-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org All uses of tswap in that file are wrong, and should be using cpu_to_dumpN, which correctly tests the endianness of the output. Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- dump/dump.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dump/dump.c b/dump/dump.c index 279b07f09b..7101169ecb 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -907,13 +907,13 @@ static void get_note_sizes(DumpState *s, const void *note, if (dump_is_64bit(s)) { const Elf64_Nhdr *hdr = note; note_head_sz = sizeof(Elf64_Nhdr); - name_sz = tswap64(hdr->n_namesz); - desc_sz = tswap64(hdr->n_descsz); + name_sz = cpu_to_dump64(s, hdr->n_namesz); + desc_sz = cpu_to_dump64(s, hdr->n_descsz); } else { const Elf32_Nhdr *hdr = note; note_head_sz = sizeof(Elf32_Nhdr); - name_sz = tswap32(hdr->n_namesz); - desc_sz = tswap32(hdr->n_descsz); + name_sz = cpu_to_dump32(s, hdr->n_namesz); + desc_sz = cpu_to_dump32(s, hdr->n_descsz); } if (note_head_size) {