From patchwork Wed Jun 5 21:15:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 801637 Delivered-To: patch@linaro.org Received: by 2002:a5d:5610:0:b0:35b:5a80:51b4 with SMTP id l16csp36539wrv; Wed, 5 Jun 2024 14:16:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUKuu2IY69cuMDNIRGxNynvZRXMuf3Mmor0t+Z52iaDVrKABxS7n2HVAh76hCeY/M36ePyWZ1bc5xaQh8aejgYa X-Google-Smtp-Source: AGHT+IFjB8W633lEY5XqxHGAY/Zgta36d77hbK1Wwi7lNNEEJuqmAIWrNPoHvOHdVWA/wAo38y8W X-Received: by 2002:a05:620a:70db:b0:794:d593:8a7f with SMTP id af79cd13be357-79523fc2cdamr381189585a.54.1717622218534; Wed, 05 Jun 2024 14:16:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717622218; cv=none; d=google.com; s=arc-20160816; b=M3XORoBFRVhpegKYc2ynUinpwKyD/av3vGPWqVNmJeYjk4OrrG02g0PIP1QtlAIbYd 9mDLMOJECHds3QGtBNAyb/ZzLE+bTblO1H7ET63qEyDK6jXgJyau6MiuyrgbD+zFSkCy vWW+cEmwYVyAzaIZYTlLa3ghP8uH0+tXFZr4kND5gjv2Gje14kX6Bj2x6b12UgqT5UBb KvTbxDkt263JLxTBGfdtRUeiR4RSCyo728dJMODVoE8J4/jB+uzOGvXD2zPjqEi5A31H Oi2SpDL+63esbk7Oi4/KMwmNAmtChlhBKNderbKnkIsSBT/DnQuBZkD3hTz77XO+viag zS5Q== 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=TgL42mC7jE0u3HD5Jwp7lhtcm3jXE8Mj7V3RtjF1NUM=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=v5HUlJEG5HBDnEc1q+GJ2mdekE+RCha71Y8lAmpNTWl6+4JvGec48OAJuLFaIX8t8V R5hVC4B1hwdAFCPi6xCmK0IkMyOaGDnNoxXxrvb9un6BfdpOYC98auFaB4XbmnCMo3VH LjKcNGAuH0Jf3hMjAatnCQNO2Iqn+A5QhE/HRk4P0zsFrhgQX/kWhkmlEnpvPJj3abr5 qwWxhwGqoHObk4ADWpDpH7SW96VqPNXBUqhbfqqIBCQxMsv5R+r/XEiZOk3WHMbBj7Mu eNpvh8gCBu8HMJEDanBjXwp5XlSFBWiNx4z8Nn4VHDs2D7+XnS48dkxEqIZqhIl+q4/2 AwJQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eOJ7K1dY; 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 af79cd13be357-794f30630fbsi1542469785a.226.2024.06.05.14.16.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jun 2024 14:16:58 -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=eOJ7K1dY; 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 1sExz2-0000fs-KK; Wed, 05 Jun 2024 17:15:48 -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 1sExyu-0000cw-S5 for qemu-devel@nongnu.org; Wed, 05 Jun 2024 17:15:41 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sExyj-0003Q1-Ge for qemu-devel@nongnu.org; Wed, 05 Jun 2024 17:15:39 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-7023b6d810bso199745b3a.3 for ; Wed, 05 Jun 2024 14:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717622128; x=1718226928; 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=TgL42mC7jE0u3HD5Jwp7lhtcm3jXE8Mj7V3RtjF1NUM=; b=eOJ7K1dYloajCjYjB4VRf+l9+CMpLo05pKi92Ggd/ivvGS9HO9XsmsN99tcXGJk7+x LcMiskv2owZM29Go2f6nGb3WoqekUY0Kb5uEq6NFXDx8aQUlDbJhZx4m9So3p3/rgQB5 gDcwduJTygYIILh4D8gwhgD+O/76GVqbqj3H/2DxjMOKEUkDssyyTEiDtvSaSJk82EpZ w2ikQmrkomOzgL1Byoe1LWyn4u9qznvUZQVmejGuErIDi1XXU68pWE+xWXWWamlQ0PCS qgqfF4YTkNheslx5fFdDx5n7RMKbh0R6EonB2xthAzsv9F8LTxooLNVcbirCvIakm613 aH8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717622128; x=1718226928; 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=TgL42mC7jE0u3HD5Jwp7lhtcm3jXE8Mj7V3RtjF1NUM=; b=V5jr8ZpHJkRFDEN7B8yJa74zHVSzUdbKIpgZJ/5yE3cgifkSRa1Ociz6WkWUG5rr80 RSgu80f17bKvxp+6Ci4WrYpJvqToDoSiwQWPj9ABa8rAlJ9f8sdVFBG02WxJSvuNpLaj GkekUOdRid4e3xlQ2FqUmcNDt8qIPRR0TCKIypZnt58HulC6dz4nPqJHK1q28mLCEmxa v2UK7zog8PVnXVfZ0wN7+OAVSqoZpUE4e9LiAsAwafxg/3Th9Y1eIqZSW8P3uC018ZM9 CEWRCBHP0dD9E5NYDg+FZw6Qy7e4sBa9CQnfevVxnxrz7UAb0DbqlBp1HTBYHDnrbBGB vDjg== X-Gm-Message-State: AOJu0YzAnkOWNAtTwIE4P+ypKlqbzys3xEG7zmUTmIwkbsW/4UTcqYqb WqvbRrsg9TqhGoEm46J186GNd3gXsGoda0BxaikryR/G8PIpGgXv4xavO6R1MEn30IeC+vdNJPr D X-Received: by 2002:a05:6a00:1d0c:b0:703:efa7:e594 with SMTP id d2e1a72fcca58-703efa7e8dfmr2127404b3a.33.1717622128148; Wed, 05 Jun 2024 14:15:28 -0700 (PDT) Received: from stoup.. ([71.212.132.216]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70242aec7d0sm9347538b3a.99.2024.06.05.14.15.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:15:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 06/16] hw/scsi/scsi-disk: Use qemu_hexdump_line to avoid sprintf Date: Wed, 5 Jun 2024 14:15:11 -0700 Message-Id: <20240605211521.577094-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605211521.577094-1-richard.henderson@linaro.org> References: <20240605211521.577094-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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, T_SCC_BODY_TEXT_LINE=-0.01 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é Message-Id: <20240412073346.458116-9-richard.henderson@linaro.org> --- 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,