From patchwork Thu Apr 11 10:15:48 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: 787943 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp149099wrm; Thu, 11 Apr 2024 03:18:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXeP++mC3mFaRrnZjeC/YPxE3sd0t4j06egs4LOuvmMtMhjABJnAcDhB4s9lrCjG8gI+q38piExCeUW3mJLAfkw X-Google-Smtp-Source: AGHT+IGTYlJg8IQjYse9nF4QYqEdTYLjrNHbxyrfkCTyT9ppUKYwbZEMbTHHDuTAXOQT8MGcz5BR X-Received: by 2002:a05:6871:522c:b0:22a:f96:28b3 with SMTP id ht44-20020a056871522c00b0022a0f9628b3mr5653476oac.53.1712830696268; Thu, 11 Apr 2024 03:18:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712830696; cv=none; d=google.com; s=arc-20160816; b=EzN09bH7FJl9ZblXUT1jtCkkxSADt6SwLGJHFix0mdJxp9shLJN2sDCGVPDGLD5MlE ivDZqHJ0bnsKBljiYm3Mn5HIcTiUyQ/Hn0igY2Gs9MKl8Iff1RhgJGHf7o2m49xRggHw DWSeQB931mb77PHtL5Gh32hslIfE3xuGCju+8ZylHf9qsd5p9CDOhXM7s7pjhqQT3EqE iM6kLb0bJJRUkOU/rX4VilRrzRIXhJlGqhu0a2U+QhMv3hqrBVHGUm6+ubrkWP4tYHD9 UkFrlrKcuyvVqiKRfw3okufQs/N7IGbaFxPLxF9x1yIllzwklWGDWlq50KiWcIn33Wvy gdnw== 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=XpfjBls1Q1Prp7MdrT8xYPE9RcXt49p2EGfNxpQiHmA=; fh=6R82/UGa7ltO3OAcYr6T+sVHeXf1vqtPCIpGPywXKxA=; b=B7vqZucRzRPguBVGAXEWHIZz8WgMn8baeRVos+jAB+0mTnZu6pWm6IRA9ZlDrZFymR aqjPiy/LrP2xVj2NzeDj/yK4xUeNK9Zi3ySDJlrfH7DujY/TAEwt7YTbGnZTSxTK1xXf K4oSfG9Ix6Tpw4OsUwyfMOsvpPOdR7QPIvQ1T/Zs2HLKBQzo0wNWNbpcZHmOB4h4iIdj 6VWNUdcAdongG9cAHTTlP7ehU3eMMXw0Pp0Rl4DYic0eStD1vgclKe2Fdp/dRrIfP4As p4+oDtRN+iAbXLrqcO5BG6FjxJAXlMy1Bki6fvMBo/6edePm4HlrzoMk4cM6eHvQLVEZ AZqw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SBMP4xtG; 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 dh4-20020a05622a4e0400b00434e49e8caasi1110377qtb.32.2024.04.11.03.18.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Apr 2024 03:18:16 -0700 (PDT) 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=SBMP4xtG; 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 1rurV2-0006Mp-Dj; Thu, 11 Apr 2024 06:17:44 -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 1rurUV-0005Ww-Cm for qemu-devel@nongnu.org; Thu, 11 Apr 2024 06:17:18 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rurUS-0007ct-Eq for qemu-devel@nongnu.org; Thu, 11 Apr 2024 06:17:11 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-33edbc5932bso5751574f8f.3 for ; Thu, 11 Apr 2024 03:17:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712830625; x=1713435425; 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=SBMP4xtG9G3waBZ60GaxVAKGy0nKpYbbPDfPoyAF/cFANqvvgpAhX1aqMzUYhqtKEU moz9KaKHyFm0FzqC/eInvu3pG8zDKdGyDs1NsUw0UzT5cTcAmcRoAVC1cQHYW+RqOR65 OVE9YtFblhh6CXzHdcjxCXMKAVfv6Dk4h0ucb65NFKxcg9W3irjppCOkeL1wp7nAptMD irXqp8DNH2ly1P/iTPBGH6LYyxENGeB/5hNCuL0/JNUBPiwtfy9RWDVuG50f7lsDRtp2 xcxtFX1ipgrQdNfIDeNw3pyVlMYGDesTBP9MvW6ZIALVL/OoyMXlH1b7F+uCvdPlJa1V d14Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712830625; x=1713435425; 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=aw6Vv9A83+S+HJ8fBvb2+bA/Kc66oUo+RzaI4xIDVAMk9HjlMeFtfcXgma6J7aG/5W 4yiiYUKfuZ6UV/PwcgiPUm6NEv3igDZqaX8UAo1ryEsTVFjPmmPY4mnwTarsgfU3dzbg IVtxYubiKTqLb9gDGwS5qERxUuCebhZiBs2+H6+Vgr4M+HgON9Akmmg+gYrhqLKPpNUx 2GCw9kYwqnbvViKiEshA2JgczABI4JNWbsTNHEHvvV7BrJw6twEQEbTzUfyxL2SJePGg W5I9LNnxUdZtVAQcvNvEjPgRVOw9Wn3H4RML70YPUw1o1dlnbe2siEsOBUJhBA2fVxMj 5uQA== X-Gm-Message-State: AOJu0YyebH5xCaYd+JGq1cXvoh7w3UayyhSEuiB+2DYdasvd3u0ra840 E8qJfN0Jj30p7okEQzTnIQoNgo1W4iD1vznpZQkO6k4n66+hMF1D4Uv4vtGQZHwY/McNRgZsqJh I6ag= X-Received: by 2002:a5d:4385:0:b0:33e:d448:e48c with SMTP id i5-20020a5d4385000000b0033ed448e48cmr3184277wrq.15.1712830625598; Thu, 11 Apr 2024 03:17:05 -0700 (PDT) Received: from localhost.localdomain (137.red-88-29-174.dynamicip.rima-tde.net. [88.29.174.137]) by smtp.gmail.com with ESMTPSA id i2-20020adfe482000000b00343bd6716b3sm1406416wrm.99.2024.04.11.03.17.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 11 Apr 2024 03:17:05 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH v2 12/13] hw/dma/pl330: Use qemu_hexdump_line() to avoid sprintf() Date: Thu, 11 Apr 2024 12:15:48 +0200 Message-ID: <20240411101550.99392-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240411101550.99392-1-philmd@linaro.org> References: <20240411101550.99392-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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=unavailable 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 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); } }