From patchwork Thu Apr 11 10:43:38 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: 787952 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp157240wrm; Thu, 11 Apr 2024 03:44:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWdrXGX4bokvP2i4dsqYKQp/16b5/QUIjU+7FSmHkKZhbf8PwgFq+Wmq5xrdJaJwGkX8AEXoOMTIyHK2IIAcuVW X-Google-Smtp-Source: AGHT+IECy6NrtmB0UISx/Wu+xiKkMWly4Xzq2lWTHgN6cVZUC+E6kdg8Pj4DA+5Wdxyfi4bgi8cn X-Received: by 2002:ad4:5bc7:0:b0:69b:29b2:9ae9 with SMTP id t7-20020ad45bc7000000b0069b29b29ae9mr4381908qvt.64.1712832294646; Thu, 11 Apr 2024 03:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712832294; cv=none; d=google.com; s=arc-20160816; b=DAyCfuz7DegoqFk0aqW5WUD9MqpJgKiDZmtSeUFqVnx7XDLEzA6hfwJQMeGJEENSBP 2TBc6gqtVl1BWC5dIbcjMXhT5samKSZWj43TyjczJATK4qnQjoXd33JZxaAoKIhFkitf mwvNEgHFl4BIZ2duCV9KKpWRO6WRQUNhf2V5Y1uj8ZzKw/bSJtkgFX8oAKiKRnhsxwKu Cqba4YY2+3Zr4GS+L2NBWnNA2Hjr4lYtszTrP8kUWR3sJ1josy67S5CigSAs7OPbw4IE yOGI/jcmcqJFJdcSKMotWHAQb2GJ5mb+Vy6rs9TQCpgksASAdgPI9dV5D8+0xEowFX+j dSLQ== 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=xiqqVJM+uSsQysg2/XmJ/Md8TLOTVsfYAw0sKCriLiE=; fh=6+Pw3xH97gGFzXYf3RZiDG0pTwma7nr3SVorOjtmMzQ=; b=fjUb4HB+HofABJQToukFigvb7DnMiiVkZDl9p5vHcmR4Ebm3eVj0xy+K1yK/iO1Nas kC90l+qLFph9hQMAFIk04LGeHtZlfhao7xLxCk7d0bOAYJhO8HGqAemaAKkpduxYJkkO 8+uCumuFduewZQ46CjUlNKK2mY9S378XxuEHPLTlO+SWIGi6NGLGTWVNAq8CybZfycfa RRSzV0qnjifPM8mrdrmQwOFt3mfx2kypxgxrO2u93XO8fdLvPXPvwtL4JV8T3EVPo/hA SXVk81aLQumB74s/qEbOx4r9spuUh/s7/XHCrS+NP9tnnvSNarwhXKBreYYbraVVZuRB 168Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GZeFCtW9; 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 m12-20020ad44d4c000000b0069b4d64ab0asi679345qvm.339.2024.04.11.03.44.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Apr 2024 03:44:54 -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=GZeFCtW9; 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 1ruruy-0003OX-Bq; Thu, 11 Apr 2024 06:44:32 -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 1ruruu-0003N8-VN for qemu-devel@nongnu.org; Thu, 11 Apr 2024 06:44:29 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450: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 1rurus-0004Nr-GL for qemu-devel@nongnu.org; Thu, 11 Apr 2024 06:44:28 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-344047ac7e4so433281f8f.0 for ; Thu, 11 Apr 2024 03:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712832265; x=1713437065; 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=xiqqVJM+uSsQysg2/XmJ/Md8TLOTVsfYAw0sKCriLiE=; b=GZeFCtW9AOmnpwAxKfWv9ISvHo97cnyH/2SgCnGbG8O41ShKUf87tOeZFwkDYtNGwF a6/z6Pp8NPeWLcsXQm1nmM3Onw58KbDYigvUXot1c8FDcroYsGvgEWBpK8IM4Cc7lFAG iRvGJIjBdjA5zm0WnTHqUawBCvZCh+vLhC5dsO974tlMfnYXOBWlB6fVN9yjsbV0Qgvt m47JjFs6OYT1ic7MO+RiQa2EQvt1xwb9X419iK9mwSGJNW53SJT3PuCaIzqkYQf2PjNL Hz5aQQPQZh8BACQwP+bXUpYitcYFZ3sbWWBoFm+To7w9/La2P9o7fAEih4fqh+XDnYun FIGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712832265; x=1713437065; 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=xiqqVJM+uSsQysg2/XmJ/Md8TLOTVsfYAw0sKCriLiE=; b=gfuVJiTTFDVQfxAxW36sYu9LmMGo4gVR6elN/Zl/AIVkgdeU5SapiZxeNtKMGaz+WX hYV0ffJzdyovh0KifFKFdXV2KVcjIyd9W3PiQStZuxKvRoeJUC8wDBg1I890Qs1WV5+V eCgWN33HkEacDgeyKlg0jMCrXbOCTKQoXdppbivdykuGpQ0+k+FhVrlsJPeYEcumXaMW Q3CngzdaFNlXzqREUAVoR/TeyddyCgbk+0KF0jYhb+PgUV4t/dzsP/rfNKwtg414efrV 0limXl9NKgp8QLRsXYtIolyGxJ/c1u4kf2R6vDMTxbIk9rQ54ZvsCSmrsdUzrxcG/IZN rkXA== X-Gm-Message-State: AOJu0YwgwHv0vkr28yELjaVyd/CpW7wxJsN/28NCgRthOMxDnDixMsns bUE8j6MvCmlHBFBMtIb93xFdQvlqeAChQwFotP4X5uCnJzrJdQgrwhobbzRJb5dnUC2DV+Qe9QI EVJw= X-Received: by 2002:a5d:46c4:0:b0:343:44cd:7d1e with SMTP id g4-20020a5d46c4000000b0034344cd7d1emr2084780wrs.17.1712832264913; Thu, 11 Apr 2024 03:44:24 -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 m5-20020a5d6245000000b0034334af2957sm1470365wrv.37.2024.04.11.03.44.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 11 Apr 2024 03:44:24 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [PATCH 7/9] hw/riscv/virt: Replace sprintf() by snprintf() Date: Thu, 11 Apr 2024 12:43:38 +0200 Message-ID: <20240411104340.6617-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240411104340.6617-1-philmd@linaro.org> References: <20240411104340.6617-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-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=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 snprintf() instead. Signed-off-by: Philippe Mathieu-Daudé --- hw/riscv/virt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index d171e74f7b..b3fede1207 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1619,7 +1619,7 @@ static char *virt_get_aia_guests(Object *obj, Error **errp) RISCVVirtState *s = RISCV_VIRT_MACHINE(obj); char val[32]; - sprintf(val, "%d", s->aia_guests); + snprintf(val, sizeof(val), "%d", s->aia_guests); return g_strdup(val); } @@ -1785,7 +1785,8 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) object_class_property_add_str(oc, "aia-guests", virt_get_aia_guests, virt_set_aia_guests); - sprintf(str, "Set number of guest MMIO pages for AIA IMSIC. Valid value " + snprintf(str, sizeof(str), + "Set number of guest MMIO pages for AIA IMSIC. Valid value " "should be between 0 and %d.", VIRT_IRQCHIP_MAX_GUESTS); object_class_property_set_description(oc, "aia-guests", str); object_class_property_add(oc, "acpi", "OnOffAuto",