From patchwork Wed Apr 10 16:06:12 2024 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: 1922141 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=N3xqMDZa; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VF79D4MX7z1yYB for ; Thu, 11 Apr 2024 02:10:56 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruaUZ-0001lm-I0; Wed, 10 Apr 2024 12:08:08 -0400 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 1ruaTx-0000d1-Of for qemu-ppc@nongnu.org; Wed, 10 Apr 2024 12:07:31 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruaTt-0002m2-8S for qemu-ppc@nongnu.org; Wed, 10 Apr 2024 12:07:27 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-56e2e09fc27so10177005a12.0 for ; Wed, 10 Apr 2024 09:07:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712765243; x=1713370043; darn=nongnu.org; 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=XpfjBls1Q1Prp7MdrT8xYPE9RcXt49p2EGfNxpQiHmA=; b=N3xqMDZa86/KP5ggtImz01ldF4iYqq1O/1aPDpU/g5ACAmFPzq5uiSis1u2+9L/bkm qGEBLC9m/hnwCawX2VvXnEhXg9CIINrlGhxPB+5VUtmztX4lWGe5fD9hkakefQC5f598 jyAbg/MgNU/wXok1Ea1HVbFO60yPwJR2hOeMfI9tsD268EY6k3uyI0clXS42Ff/NJLYZ aa2btk2SvXbTBu+Eee9KA0EcyYBKIibfdCum/bVmVz1T95d6SaBKw5QvWwtClEZZirX3 sDzHGdz1CME7S7ZBgv53EbwH0faF2Dv/dfBDtso1uXwgB8guvaf3Eq00P4H+IBz4pnTk yjsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712765243; x=1713370043; 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=XpfjBls1Q1Prp7MdrT8xYPE9RcXt49p2EGfNxpQiHmA=; b=Fh4LCG0NdOlmqiD71ar4JxNB2asyUhSD1PTksFsw5Cf50L7NGJrZ/9klFzYxROLJ3A GOGOnPS9YGikMmqWvXhns3zmfQY3JXd1A+UWwGX88QYJI+pGK0W5kKFuQZkLdWsx2E5O Oru2ddyPiPscRq8bGPeaf4vQgj6FH9GL4kzy2htq9vmxXlo4pOd31LtiJfAjpYD/11Em +uBKnaOy9b2+siMm4RkxKUb1k0hpMrwcAccyN6zX0LVHNh8V3+qJTpXkPB2xDJaCc9RI gpF7ZNsj5DOK5+3N+8F4TsFhO3HsFWc5/puLtj5F46cR47gRdczb+GPUJLd6NAjRNEXg dgCg== X-Gm-Message-State: AOJu0YybUgcRrAdIA8Bc2XX0IWW7+OMbm47pvMpTqTi6WIriQYxpfGe3 DNpI6ZJNx83+YqHlMQUZFSglZiZY1ZRmt/Yq0VDLEBPByvazgQjGnhX6YzfYQrk= X-Google-Smtp-Source: AGHT+IFKQSC72dunI2u+kZ6IqCSxRMN/G1zfIVesfOLY3KgXO06qFSjVwtRjoNU5a/IEXnn2kJ27jw== X-Received: by 2002:a05:6402:1955:b0:56e:6fcd:bae7 with SMTP id f21-20020a056402195500b0056e6fcdbae7mr103914edz.5.1712765242764; Wed, 10 Apr 2024 09:07:22 -0700 (PDT) Received: from m1x-phil.lan (arl95-h02-176-184-34-173.dsl.sta.abo.bbox.fr. [176.184.34.173]) by smtp.gmail.com with ESMTPSA id h25-20020a056402095900b0056e62321eedsm3669224edz.17.2024.04.10.09.07.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 10 Apr 2024 09:07:22 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH 11/12] hw/dma/pl330: Use qemu_hexdump_line() to avoid sprintf() Date: Wed, 10 Apr 2024 18:06:12 +0200 Message-ID: <20240410160614.90627-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240410160614.90627-1-philmd@linaro.org> References: <20240410160614.90627-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=philmd@linaro.org; helo=mail-ed1-x52d.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-ppc@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-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1, resulting in painful developper experience. Use qemu_hexdump_line() to avoid sprintf() calls, silencing: [5/8] Compiling C object libcommon.fa.p/hw_dma_pl330.c.o hw/dma/pl330.c:333:13: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(tmpbuf + strlen(tmpbuf), " %02x", buf[b + i]); ^ Signed-off-by: Philippe Mathieu-Daudé --- hw/dma/pl330.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c index 70a502d245..0435378b7e 100644 --- a/hw/dma/pl330.c +++ b/hw/dma/pl330.c @@ -15,6 +15,7 @@ */ #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "hw/sysbus.h" @@ -317,21 +318,14 @@ typedef struct PL330InsnDesc { static void pl330_hexdump(uint8_t *buf, size_t size) { - unsigned int b, i, len; - char tmpbuf[80]; + unsigned int b, len; for (b = 0; b < size; b += 16) { len = size - b; if (len > 16) { len = 16; } - tmpbuf[0] = '\0'; - for (i = 0; i < len; i++) { - if ((i % 4) == 0) { - strcat(tmpbuf, " "); - } - sprintf(tmpbuf + strlen(tmpbuf), " %02x", buf[b + i]); - } + g_autofree char *tmpbuf = qemu_hexdump_line(buf, b, len, false); trace_pl330_hexdump(b, tmpbuf); } }