From patchwork Thu Apr 11 10:43:37 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: 787962 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp158039wrm; Thu, 11 Apr 2024 03:47:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQ8ws//6yJ5JFaL2SWaLkhlVN2ZQPeN9YtCRguy+dBrVKJNkCBTVSKKcZVCFGnitI+5/NKOmDdhFpR03s2elvG X-Google-Smtp-Source: AGHT+IHlzxJXX4UKhBXMOAAenaZOy6Vr6k58DiS79WewRVz4ChLwgVpYDNQd8P8r2ksIOhv9Xmk5 X-Received: by 2002:a05:620a:94c:b0:78d:4a14:b307 with SMTP id w12-20020a05620a094c00b0078d4a14b307mr5600838qkw.44.1712832432789; Thu, 11 Apr 2024 03:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712832432; cv=none; d=google.com; s=arc-20160816; b=sCzSrCnjnixjXZagaLdJbRQxAUN09nZCWzDvL/Q6OpoKgJm9ukL4dZjQxmkLM9AQBI 3gDmQhZWb9SH2Yf0MpjU5VFj/evITB73bPfqGgYhtcmfQf4+4oSSlhGYN9qBTi9Fua9r xChH7RffU+CHvpoOLK0vBUi7f+01GGRBT53GJXMYqdSm5L6y8PzCy+2UQVAD6fIrvPdX ZLzbDcoQk52/eDRkVbAeKjEjiJgGU9lJKuEuLoOblSmqlefnJN1oSDzwhbm9sTBveovC 7zstKaYrL5+iIqo3M8waLN+VPbiIGDszFDB9gD1pNbN9o5Dw3EzegMxITxjho+s+PFTQ oOGg== 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=chFRh2l0gcnmg03fCHQ7SXYogZ+gzE1I40m0bX1o6CE=; fh=Slfxqi71ANSv57wMlZx1Qriv6VrM0by9S3CAcx97i5A=; b=stXhkR/2y/Y+DasWh68NHxJwjJBLYTNI6cZ1UEAX/Pp+EMhnMHqJiF0zYikHmeQtoY XufPL8DR9A4LfQHzwLV/mm6eb0zsDn9rF7JK7+7cTjkbHe7Kr0ErIvIi81zDSErvpA/A y2RboBDKKbIuXgPtbdMF96Qeue/iUw4SJHJOkz7HAQHcdR+tdbQwNrbb5ZqQEgIXcXnL 9ez8lzGItJ/oDsHT6xZMna5vRen4kHxoRbQQr4g37kH1tVT2Kf2SGyZovrjwGf7LFwOW vcZgCxHk6Gxr7uXKII3k4gM5w1TiCcYB2N/Hw/WsBYLD/CoizDra1n2C6iJCfjeZU6my 3CUg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c5j3mEqI; 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 xy7-20020a05620a5dc700b0078d5d6af5bbsi1249011qkn.650.2024.04.11.03.47.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Apr 2024 03:47:12 -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=c5j3mEqI; 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 1rurur-0003B3-JZ; Thu, 11 Apr 2024 06:44:25 -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 1ruruq-00039P-5G for qemu-devel@nongnu.org; Thu, 11 Apr 2024 06:44:24 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rurum-0004Mv-9z for qemu-devel@nongnu.org; Thu, 11 Apr 2024 06:44:23 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4167fce0a41so4154555e9.0 for ; Thu, 11 Apr 2024 03:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712832259; x=1713437059; 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=chFRh2l0gcnmg03fCHQ7SXYogZ+gzE1I40m0bX1o6CE=; b=c5j3mEqIll58L5zq6hJWJGZLhH1d7hh/36VU6fYKyFvE7mJflDy8Z6/IxZVkoclLC6 Us8uwAhhcOIjWRB5wKRchzmwBY9E8yf6W7fULJ3Be0ehRRyuTjBJs7WSjbMAS975K7I1 PnAl+pFAkjmudj99nUZ3jEWvNGzGwp9ZFJi3xAI1T/6HJIcJkRuntvyUWhmoIvfjTisP akSmFEtZuSWCMwto/n3+ztSYikX0U5COHsw7i6pKKvHG7ObedGuMRSDVuA/150ek0E8q 4YLe8V0pNGJw0WHllYGIl96QB5dm81ulpqa5jVyiGSJeSyrl4gIdQ6bbft69/BKMkLCJ wjdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712832259; x=1713437059; 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=chFRh2l0gcnmg03fCHQ7SXYogZ+gzE1I40m0bX1o6CE=; b=xBwPBnCS8oSlEw6+Go7n6x+vOtgtGDmw2RPeOSYx0NwuJkike8DVwlMi+mqN6MLpTB sB0cXvN72kI5VwcnmGeOVlNjKIsWgT5221c/TT2YJzjevnwXFqes7lfY2UpXN1eCD1xH rl3FBfOy4NgSrIKioMvpPW2+GK6pbdT3TQvpoKsHqqkG+uK5BcaHTzHE5lp+0jzXKwIN 93di0f0spfNRc7MzUhvA4H8RmHrcDtweDze6QQQc/0jUzv8cPzgL7ClwUq3o+32m5T22 66grUyMG6w3km1OallKyM/DjV3jhUSSF5vZxalvSOcNhbCnlUKoAYXotlq54OE8uVGJW fVpA== X-Gm-Message-State: AOJu0YyVM7mzIByMp1duwxkLgcjkqgFI5kNcS+SosBt1QFwP5hVT88Bi rchMeJzYn5EX+SOhYRxNsRg8Y9BwDkuJ6TsqtgHuA3vM+ZI04LRB2N9exXJCvJ4ZpaK9UTAL2b0 7QFY= X-Received: by 2002:a05:600c:4f53:b0:416:89bc:dec6 with SMTP id m19-20020a05600c4f5300b0041689bcdec6mr2004919wmq.11.1712832258773; Thu, 11 Apr 2024 03:44:18 -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 he8-20020a05600c540800b00416a08788a5sm5123079wmb.27.2024.04.11.03.44.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 11 Apr 2024 03:44:18 -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?= , Jiri Pirko , Jason Wang Subject: [PATCH 6/9] hw/net/rocker: Replace sprintf() by snprintf() Date: Thu, 11 Apr 2024 12:43:37 +0200 Message-ID: <20240411104340.6617-7-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::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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/net/rocker/rocker.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c index 7ea8eb6ba5..03ac7a7ae9 100644 --- a/hw/net/rocker/rocker.c +++ b/hw/net/rocker/rocker.c @@ -915,40 +915,40 @@ static const char *rocker_reg_name(void *opaque, hwaddr addr) switch (index) { case 0: - sprintf(ring_name, "cmd"); + snprintf(ring_name, sizeof(ring_name), "cmd"); break; case 1: - sprintf(ring_name, "event"); + snprintf(ring_name, sizeof(ring_name), "event"); break; default: - sprintf(ring_name, "%s-%d", index % 2 ? "rx" : "tx", - (index - 2) / 2); + snprintf(ring_name, sizeof(ring_name), "%s-%d", + index % 2 ? "rx" : "tx", (index - 2) / 2); } switch (offset) { case ROCKER_DMA_DESC_ADDR_OFFSET: - sprintf(buf, "Ring[%s] ADDR", ring_name); + snprintf(buf, sizeofbuf), "Ring[%s] ADDR", ring_name); return buf; case ROCKER_DMA_DESC_ADDR_OFFSET+4: - sprintf(buf, "Ring[%s] ADDR+4", ring_name); + snprintf(buf, sizeofbuf), "Ring[%s] ADDR+4", ring_name); return buf; case ROCKER_DMA_DESC_SIZE_OFFSET: - sprintf(buf, "Ring[%s] SIZE", ring_name); + snprintf(buf, sizeofbuf), "Ring[%s] SIZE", ring_name); return buf; case ROCKER_DMA_DESC_HEAD_OFFSET: - sprintf(buf, "Ring[%s] HEAD", ring_name); + snprintf(buf, sizeofbuf), "Ring[%s] HEAD", ring_name); return buf; case ROCKER_DMA_DESC_TAIL_OFFSET: - sprintf(buf, "Ring[%s] TAIL", ring_name); + snprintf(buf, sizeofbuf), "Ring[%s] TAIL", ring_name); return buf; case ROCKER_DMA_DESC_CTRL_OFFSET: - sprintf(buf, "Ring[%s] CTRL", ring_name); + snprintf(buf, sizeofbuf), "Ring[%s] CTRL", ring_name); return buf; case ROCKER_DMA_DESC_CREDITS_OFFSET: - sprintf(buf, "Ring[%s] CREDITS", ring_name); + snprintf(buf, sizeofbuf), "Ring[%s] CREDITS", ring_name); return buf; default: - sprintf(buf, "Ring[%s] ???", ring_name); + snprintf(buf, sizeofbuf), "Ring[%s] ???", ring_name); return buf; } } else {