From patchwork Thu Apr 11 10:15:46 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: 787945 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp149155wrm; Thu, 11 Apr 2024 03:18:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVLWN7JXZZFNZE76oKwdDwzdXjl5I1Qw0ID3A1hbdXKyCyIQ0I+l/ZiOD6cnwhSqTG5xS+N1LRSZQaqn70vFYNf X-Google-Smtp-Source: AGHT+IEOO3m6OWeCUjlNQ94g/qwiynOANwsplXiBlHwBZILmkqhyRzuzhKsuU+7Di02nAt7CyTqH X-Received: by 2002:a05:6214:27e8:b0:699:49d9:1498 with SMTP id jt8-20020a05621427e800b0069949d91498mr5901424qvb.30.1712830706775; Thu, 11 Apr 2024 03:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712830706; cv=none; d=google.com; s=arc-20160816; b=d1FSxDxpxf3em9GAZLlrOhy9uU1g02dO2sGk2NePQlKbCPTN8MTr8czUMihLpRUulE 4gYVK1ZRAzObWsecAyVzhtXI8TFrl8ZveOTio5Ok2v+OtYOqyV303OhjJzo7bKPnENTg m+utqWAr0Pr0sYfBpo9Wxf2DlT8wrvzRWeQlByMeBV/NCi/Ado6JatgTNsH3K7N+99Dc BDqc7m1X6tM00AhfWSISqe9TFjGezY92EoYsXbEBFPwcSS63Bm3v640fYxjyWwF4U77v VlemQq0bTOm7VdfSYyA9/KfB3qebfLXLt8/LE/Gn0BpuWeRlIHk7w4qaodsLqrJ6WZON pawA== 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=uTBiEhTzp1kNucHHGCAS5oGgSgyR51XnqsaO8y3FJzk=; b=v/6zfulJH5A27z54M9Iy7dJGXHNCNsfUa0NbHPeaAUOFN0mKNwdWe8UW1XZhYrhlFl ZrlHKmO4TmhQDyrwFBBbS3s+bZn0yUsDK1C23eUbSCT13HOL7Fpo1P4KiwZ5BrZI6ISi GU9eNSS38pUbC/00ZbxBR/pwGClMnvITXXUbaGgXtdVXWRxIw2vF61lLAE8rEacQKbN6 /M8lY8UodaBVyudIrydAeGncVB+1YsFYGDYhI9WE9AFA2YSE46s+7jyPMevBOgzbVFBv TAHRXgPHPNvC+LcJf+JA2nHVji4EmXUiGxicNnYbbgFWgx94mraam6hRCZC/dvhPxxDM aaCQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OSBc6wG+; 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 f5-20020ad442c5000000b0069b50429ed2si338859qvr.479.2024.04.11.03.18.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Apr 2024 03:18:26 -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=OSBc6wG+; 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 1rurUw-0006CO-6L; Thu, 11 Apr 2024 06:17:38 -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 1rurUK-0005MV-IU for qemu-devel@nongnu.org; Thu, 11 Apr 2024 06:17:06 -0400 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rurUH-0007bF-CO for qemu-devel@nongnu.org; Thu, 11 Apr 2024 06:16:59 -0400 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2d700beb60bso123181411fa.1 for ; Thu, 11 Apr 2024 03:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712830614; x=1713435414; 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=OSBc6wG+2rBkcpRghqTREESEvkDIHxU1tiW/aopm0NA7XmJngLRzAOe6LpUUKgrLVU ruuGvQbRRl2zRHczezhHm1a1ncYO6IB1D/U3OMvxdygk6SBCL3D9LvtSACmuj/DFF5d6 qxs+EhjitLV+NfXTjS2+Ra7MX91wYwTe4aqerPZeuPXGlNvEju3eZ0sqb03Qm8vF0tAi PLplMIXcntOsJpZNuzJrhuP6YguSjGggNrQL7ZILHAz25rn1vav7OqHgkTn8ggh/elck U3Xu/lU20+0Lxr4+KB8gFCrhgqtZI4hc7BqSjIWh5rPgWEO+zFKAxtGtpvD4DAxDdgAM NRVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712830614; x=1713435414; 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=cWA88EKt7UudNfaAHl/UjoTP+EjTIUWyG81LtqVnU6XylQ7bsFHixDIlJPv1Tmho6/ Hjp1dy1dD7RPJFTcQWNHBkIYVYTplejJHR/B1+NPAWwpmwgO2WfYad4ZecX/pqzDV1/n y0PLJxseenovKnQLaiiJEWHPkqztZrUFId/eupdf3dJmK2YfDWlnS/+py5SLqdYc+c1v Gy4NhUoagBGwr14hV2UErsQF0NJXp4ZYGzISXTelVTXy25//lJIFxmYIQwE09Ry1iZeY hmCTD1nF5pWfJe/DtCrxwRAZtSpOvNUM+IethXQHbIiDMtnUjf4mRt0+2Hy1ArKK2oIg LsYw== X-Gm-Message-State: AOJu0YxQBl7XLwwPb1wKZQjlrNnGBrzCzKqnm8sXDjNaOFV9rbzgT09Z 0QvJ8advIrvLoTwQOPniSBqQSbMvkmZoUz1YoE4qEHikSO6lsuC170B8bsx3PPiBdF8Qlp+63el Qv+A= X-Received: by 2002:a2e:9317:0:b0:2d8:5fe6:820d with SMTP id e23-20020a2e9317000000b002d85fe6820dmr4355192ljh.11.1712830613862; Thu, 11 Apr 2024 03:16:53 -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 iv11-20020a05600c548b00b0041665b6e111sm5064848wmb.12.2024.04.11.03.16.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 11 Apr 2024 03:16:53 -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?= , Paolo Bonzini , Fam Zheng Subject: [PATCH v2 10/13] hw/scsi/scsi-disk: Use qemu_hexdump_line() to avoid sprintf() Date: Thu, 11 Apr 2024 12:15:46 +0200 Message-ID: <20240411101550.99392-11-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::234; envelope-from=philmd@linaro.org; helo=mail-lj1-x234.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);