From patchwork Fri Apr 12 07:33:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 788252 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp590541wrm; Fri, 12 Apr 2024 00:34:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUIEqgiYv2wcWDS5hY7vg4l2WYMMX1quAwX28I8N1TfmxM6XMq3vaF5N/0oBcy4/aLVm3PF/tLFdle2RKtOTVIZ X-Google-Smtp-Source: AGHT+IE/zFlMBW5jPbq375PdaOtWPD/bXwlN2SeTlmfZpVcuZz0b2V0Z/2S79+f9L3L6PeX4NJOc X-Received: by 2002:a25:bbd1:0:b0:dcd:24b6:1ae7 with SMTP id c17-20020a25bbd1000000b00dcd24b61ae7mr1516308ybk.63.1712907282487; Fri, 12 Apr 2024 00:34:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712907282; cv=none; d=google.com; s=arc-20160816; b=vAs46zBrRRBswiQqhs3vT5Xrzv8NaJy1Pc1edNdAi59L7y8t0h+xwz3RlKbjZSUS7i JleL12LwnvN8rKS6TI4QtCjCKuWNEcUItguxDyDU476DFYJVIM3dmssUwW/UOjq//rNh XDNLGiepn2aGdyOTDZ7etVkebAp7YMau9aBR3BV14xFF65OcKfqiO72fVx6WaDVciX70 pRLkkomIgNZBzTkL6JPMumsUZCUe/8LQsG50RRhvIaGBFJuOugeNJLj8Pu1xHEfdwI27 nWQRvwtSLr+RC4E31FZxN7raxYPl1fdpoLjqG/oXvx9InrXpDAwXKZ0Ev8myWyOXb49i V6ug== 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=7ZOZ2GpOHx19JGGX2PLqgY++2k2pqd50fzr6oa/q3CU=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=cEgBc2JFQyPFCW9BZLDn7uaOWYxnUNVxEb/SRrY/sSd4d+WO5WwfHrdH8Jy3a8rwp5 9wHsUARzOx7DVM6km6oD5Yvnnc+7koJd2sYmFYPOQHTxubR0sUWOln09siNzfeY7xVZZ 3awQ+3VpxpRA3E/OwQwbegpJZ8KdDuIGqCed8WoXTBgOsZtuCVUuWB9jKfXh4iwybRAH zsJ97klMf47AgEGJFPvo7jBYICWIWoBxRdFbfHL85Hzqe+VDEGPjRaqq5sWHH7KPamlB kywO6CuZYck9UnH+wo8gLzOVhcpHgCdJF636BORffva6iCNSg+EEISvPMrYFnQohtCTW giHA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=znqmiNVr; 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 l15-20020ad4424f000000b0069b1ef03333si1041433qvq.6.2024.04.12.00.34.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Apr 2024 00:34:42 -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=znqmiNVr; 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 1rvBQF-00072G-1z; Fri, 12 Apr 2024 03:34:07 -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 1rvBQ5-0006zQ-0U for qemu-devel@nongnu.org; Fri, 12 Apr 2024 03:33:57 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rvBQ3-00077c-Cd for qemu-devel@nongnu.org; Fri, 12 Apr 2024 03:33:56 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6ecee5c08e6so678885b3a.3 for ; Fri, 12 Apr 2024 00:33:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712907234; x=1713512034; 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=7ZOZ2GpOHx19JGGX2PLqgY++2k2pqd50fzr6oa/q3CU=; b=znqmiNVrFi4ywHzeFmQIarTlblzjn7NzQwUZMZEJ0VvKzavwAn+dgfvC4I9BFNi6UC 2JmL0I9UnASgsccFyL7cz1P9vql2I7BCS6gf6ncE/pB3Znpj+wFTVq4ep+ULhaHgHT+O GqJdo65emWbjeyQPCWoXXr/iw3PAazHOigIF3l4p3+dzhVV7Tn8e7ZxH7GheUmFb0pnV CHmD4r0b8UjiVZR25enm8Yr583pmlr7vyVSz/wnjKU+vetSgKv2VIeRLvRz+ynnegESe dJ3SQ1a9K+z1kMP4OiqfH0XX/WTW8RFpIB5ZCyjsxhiwJWNEJ3iHxNOeYsLFjN3Q74sj h4OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712907234; x=1713512034; 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=7ZOZ2GpOHx19JGGX2PLqgY++2k2pqd50fzr6oa/q3CU=; b=c40jbfhoYCBASNCeSULZ94yl8ow40MMf+zS37ag82hMsxhrCGgZTqSKBU5vQTBIuEj wC2oQZz3DkyDFPLP/Ho2ZE4MYT/18/Sb7Bd+T0tR3Akfz1roWg69o88AQ+9CfIABy0D2 /e19Wi9fGLtsURNeAcqJUqGDsSbh91VwkkQUawdbFxT3MnIfYER4qHE262MWXBnzHjS8 97bE5DHKcSkpQDSRTnPu1YmBKoqkeE8+MiFd0gsmfsQwVTMNny/WjVD/rKaJAApdeGNx tR3soCWEeOydZlOoezNkbZMkaHfK6pjVO3Y/ymU3vjoB81avKjSgIMFFJhex8KC+9Qj2 WudA== X-Gm-Message-State: AOJu0YygnwAEKIU914vJkxJ69SbeEymbK7sddwTf215ialpX+yVVHF5d 3MHyEz19tG6Z7BMH3T3pTWUimjBSpg3jUg3ZqztRETimRWKggFYZZEjUmOwT6+D8bWb9cAnx6TR Y X-Received: by 2002:a05:6a20:2591:b0:1a9:5136:13ba with SMTP id k17-20020a056a20259100b001a9513613bamr2713325pzd.14.1712907234026; Fri, 12 Apr 2024 00:33:54 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id e5-20020a17090301c500b001e556734814sm2206099plh.134.2024.04.12.00.33.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 00:33:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 08/27] hw/scsi/scsi-disk: Use qemu_hexdump_line to avoid sprintf Date: Fri, 12 Apr 2024 00:33:27 -0700 Message-Id: <20240412073346.458116-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240412073346.458116-1-richard.henderson@linaro.org> References: <20240412073346.458116-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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 From: Philippe Mathieu-Daudé sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1. Using qemu_hexdump_line both fixes the deprecation warning and simplifies the code base. Note that this drops the "0x" prefix to every byte, which should be of no consequence to tracing. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- hw/scsi/scsi-disk.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 4bd7af9d0c..f386a2f01c 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2648,19 +2648,12 @@ static const SCSIReqOps *const scsi_disk_reqops_dispatch[256] = { static void scsi_disk_new_request_dump(uint32_t lun, uint32_t tag, uint8_t *buf) { - int i; int len = scsi_cdb_length(buf); - char *line_buffer, *p; + g_autoptr(GString) str = NULL; assert(len > 0 && len <= 16); - line_buffer = g_malloc(len * 5 + 1); - - for (i = 0, p = line_buffer; i < len; i++) { - p += sprintf(p, " 0x%02x", buf[i]); - } - trace_scsi_disk_new_request(lun, tag, line_buffer); - - g_free(line_buffer); + str = qemu_hexdump_line(NULL, buf, len, 1, 0); + trace_scsi_disk_new_request(lun, tag, str->str); } static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun,