From patchwork Wed Apr 10 16:06:10 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: 787524 Delivered-To: patch@linaro.org Received: by 2002:adf:fdd2:0:b0:346:15ad:a2a with SMTP id i18csp769787wrs; Wed, 10 Apr 2024 09:13:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWRd1iAJ9sv6ntRtvt86yW3LFCq2vmSleS4a9J12WNbYwmOQ032iQhN3ZISbhQuYeE3i24JUGhARZf8W5/6WQMd X-Google-Smtp-Source: AGHT+IGYLHuWhHaY0R1cIJgIIwCIL7L2aDTOU0YMiIF64yo5O+MGg/KuJJDESCUAwK3jmFQ8AO53 X-Received: by 2002:a05:6820:1b10:b0:5aa:5457:c5f7 with SMTP id bv16-20020a0568201b1000b005aa5457c5f7mr4081787oob.4.1712765589710; Wed, 10 Apr 2024 09:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712765589; cv=none; d=google.com; s=arc-20160816; b=K+w7b+Bi7PLbbSGW9hwszdjtQay6hU5YOesv3Cr7whi3frN0JXZ/4Dc7RwuteWCT7Z 7Rnp2sGuyR1hY46c37Dh22fX7USZeKqXY4h2T3WhoqgoOySzXAgHieBX2HuDUjUymJiE q7o7Yl6OcdEd1xmTGglPALk3lrlgj7gAhM2Dqx0rX5V2KIzO6BkJKPFSbUMI+BuA+/dg mcXM79jT4g5HYIV5T6iMGDDdIFERcjOjiawjx85lRL5OVEqUxdUIbB6UGyr7NwfOW6M1 rvnLvJ6+lmmRwpWKfm0SgvZAU+7zS2hjxRqXBf+EeT8yIqDTUWtBp0YziyTc3pUGc/nX 6+nQ== 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=urm+Npyj3/f/E1cmlvhojimXxZbt++WU9CB9v2xORc4=; fh=YFVGCxpzDNSk/I4Sx5czuIx/gHz0oN2Tm8cjWcs0zN8=; b=vI/r+QLJk8tF3eKpZc0N0suhZRUyOFWAXivD2ppoSYgO8HVCvSkSWlPgD4BefK/+Fa /0iUwb/y6UmwiJL1H4QmMxNaWsARpE4dcIyovyLdvb7NfemyJcqOPFwyWM8XIke2rkfX abqtH7UZQ2gdgDA7Cqirf6AOmmmIHY4VoRNHTOXY8qiR4gSJiy/oxb0H0ho8TmyR2fKY 6dWnLkeeOE05lFeYptfsp6RhsmxRPcwtoIFFQrgpVNHxdMGB4r8MWgWKNva0zilSYSpR PuCmsJfReC7+8NpcO//4RmEcQ3pyGX2VN7BD6aoTTYO31Mxo2PvKHNKzZOBwS/HABB/S vsuw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tOOc6QyI; 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 d11-20020ac85d8b000000b004313ff9cf1esi12756957qtx.330.2024.04.10.09.13.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Apr 2024 09:13:09 -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=tOOc6QyI; 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 1ruaUQ-0001H4-O1; Wed, 10 Apr 2024 12:07:58 -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 1ruaTj-0000V2-IC for qemu-devel@nongnu.org; Wed, 10 Apr 2024 12:07:22 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruaTg-0002kP-55 for qemu-devel@nongnu.org; Wed, 10 Apr 2024 12:07:14 -0400 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a51beae2f13so504767466b.1 for ; Wed, 10 Apr 2024 09:07:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712765230; x=1713370030; 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=urm+Npyj3/f/E1cmlvhojimXxZbt++WU9CB9v2xORc4=; b=tOOc6QyIpBcgIP8g3gYoYZOb16yecid/rvj5ulN9defoMP3d8AC/czHMkyE6IPWErW zjbJCyALT9qxtj2dweeVHGRG/tKYE9ns1hHmbnNBGqlu0Ke012m/g/FOyvW8dQAxe7kF xAi70GYAXbJpOz366h5Kjgm10oLo5VrPYi3yw6hsjBNTm6R73HJTvt1HVaC51XZ27bfV O6kscC2e2Pid0h8K01Umx7ER/GU9RZJ5dS80wdO22jOLloMv2dQ3RfpFX8XQWCYO95cb Lil3ZpE/fHNa4MvsLfeqAQsEoBOQwf4fQxYR6k+cCDJCKbWaDG5ApD1Mza5z+sWN5F1L 31Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712765230; x=1713370030; 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=urm+Npyj3/f/E1cmlvhojimXxZbt++WU9CB9v2xORc4=; b=DfFZDuVAB88nBTF/hGdWNxDOSDcF2ECnyaU3G9KQyYmWy1B/2DDvMDUgqrJ+eSW//h 5T/CBFDK2LchtqbSsXWrogjj6IeujpHnIPnVNoQslA6uCmiKEI1ff75CJVamRjoXFuDy E+OEK/tot+toC7Gt2Yid2oYUFBuKptBaoG0LzYxA4ik6ha+vvIXjiEOtMAzh8aE0iRao TveEeC4bQ796RSEh6CheLPmJ5lIHf4GGKJUffthi1DIG92eJEpNn05Cq0OIJyB6ahM2X 2prhRAbZOcjSPQhCjNsaHbdQROejh/6Kst+hcgGUR70g5I1NhvCBk3n79KtQYtZ5G8CC CauA== X-Gm-Message-State: AOJu0YzbX6a9WRZ/PmLHk9cmVi0MO+RMDDeTTJ+Y5HmKvwkYqekPLkl6 mk45fbtaA8ExpCbATiuElRY6k8mQAVxlFW7fT3bq0wVtEvPFNneDCow2hYNfMYiJpOs6yPeWMlg o X-Received: by 2002:a17:906:118d:b0:a51:913c:1c83 with SMTP id n13-20020a170906118d00b00a51913c1c83mr1864645eja.58.1712765230578; Wed, 10 Apr 2024 09:07:10 -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 k7-20020a170906680700b00a51e5813f4fsm2662622ejr.19.2024.04.10.09.07.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 10 Apr 2024 09:07:10 -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?= , Paolo Bonzini , Fam Zheng Subject: [PATCH 09/12] hw/scsi/scsi-disk: Use qemu_hexdump_line() to avoid sprintf() Date: Wed, 10 Apr 2024 18:06:10 +0200 Message-ID: <20240410160614.90627-10-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::632; envelope-from=philmd@linaro.org; helo=mail-ej1-x632.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: [105/169] Compiling C object libcommon.fa.p/hw_scsi_scsi-disk.c.o hw/scsi/scsi-disk.c:2659:14: 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] p += sprintf(p, " 0x%02x", buf[i]); ^ Signed-off-by: Philippe Mathieu-Daudé --- hw/scsi/scsi-disk.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 4bd7af9d0c..4f914df5c2 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2648,16 +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; + char *line_buffer; 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]); - } + line_buffer = qemu_hexdump_line(buf, 0, len, false); trace_scsi_disk_new_request(lun, tag, line_buffer); g_free(line_buffer);