From patchwork Thu Apr 11 10:43:33 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: 787957 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp157731wrm; Thu, 11 Apr 2024 03:46:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUaWIsqQwfqU9y/CTB9kXFyuZkJC7TonwkYtsc0wfypWbbJX/9QcX8Ws65Q6jXRuxIlbnuWQJRozeyMkUn7oduv X-Google-Smtp-Source: AGHT+IGaSBLbn/cwqNJ/AQo8EsJ8GDUu3UJvIeXdc+a99LRNsCaqZUb1wKc2+onTNq2sO+CNygr/ X-Received: by 2002:a81:8a06:0:b0:615:48c5:f6a8 with SMTP id a6-20020a818a06000000b0061548c5f6a8mr5180154ywg.47.1712832377868; Thu, 11 Apr 2024 03:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712832377; cv=none; d=google.com; s=arc-20160816; b=JqKfzKi1+tcpqN+NQOXcKc70KV+2bK5uB1Yn8C7ZJM0a8aOYGRqjjWkpWc97z8nOG7 iA3JTmnFgVQEV3uJJDoiSVAErCEA5w+0AlePnEH5HBBe6O9hlxREZSE1/BrWjQSw0xhv WRbP8NEur901Wn1QpcA65g763hHAkBjC65Ai8Rg+Tk72B1xQ4tNZVmNbKda1cHYliZ75 +j+0eCINFiDnBKDZe4lapkjvbUSBa7CvbbtaQjqFsBnuRQtPLbkGV5/TlcITAjzeY9dL fWk92pZoddCILaZg7UJl2uQTuvZWDcnso8MI8UI00thdnO3LxanEN5yHw6BBWo6D0yDK Ktmw== 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=ZARctQBaWTgi16Nsw9jDwGPNb4MI5ibxpQ1TfC8D7e4=; fh=+59ao9oSc1SGxUJzhUa1UnjN6q33SXhEw+bkPs4Onpk=; b=k1TNKbG684jTyoHL7SeglHUFwvlEz8CxCNSd7mQ2m/UZ8Rukeh+yRnFujVc1uXVmEp WpNxcBYVlrkWxnR9X8YxULIpByiwYoUPlSKbIGXsmbBJMS2KnwwTx7ZOBTHI+hd77ZZ9 hG4Crq1lJYgEay7JS7F8pYS+02LbNEKboFjX8CrsxZ4W7TBir0PUMUSmZuLbz+At0Coq ohEVeWlJUEFHXY+q/k5+fwijoZLWbkhjfph+vDPwgmDRkMs8TXDWlKCD1curbt1035/c Hokgvy3XkpLdWi5HU5eumvF5RQXsOIa1b762V/URkj1cD+2IBK7/ILW53NR3BfurFnh/ xhJA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uyq3Zvys; 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 ye19-20020a05620a3b9300b0078d63a51632si1216433qkn.565.2024.04.11.03.46.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Apr 2024 03:46:17 -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=Uyq3Zvys; 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 1ruruS-0002ne-PT; Thu, 11 Apr 2024 06:44:00 -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 1ruruR-0002mv-4l for qemu-devel@nongnu.org; Thu, 11 Apr 2024 06:43:59 -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 1ruruO-0004Dv-Cd for qemu-devel@nongnu.org; Thu, 11 Apr 2024 06:43:58 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3458b699d6cso2049759f8f.0 for ; Thu, 11 Apr 2024 03:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712832235; x=1713437035; 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=ZARctQBaWTgi16Nsw9jDwGPNb4MI5ibxpQ1TfC8D7e4=; b=Uyq3ZvysZVVtHJqCKPc03g5Bsc5oinb0hXgKU+H4K5AlZ/8HcxFapInf8Z4Bz1ShGO 8KmPGbqO+fb3KLveXljBwmkqj4Zhu++jDyU5Tu6syvG3RWsQnxyOmqinSOEnHHwL90Ik SMugQiXDytI8bGOe3zaB3YhaWDdnITY+oSdm5/YHxG4v3Nyemr8sod6Qoz3r9tF0wJtN U83nfCBILtZ3labYAJlxnxic6UZaC2qjBD3SI0zVAArDrRc9RdqQ4dVWlKacV04vQ1u2 /1wZSEAcw9YeJ+mxq8/U+4CqZyJrN09hHIyo4laihz7i/96ptAHxUQkcOoh6Hmo/IooK zbmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712832235; x=1713437035; 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=ZARctQBaWTgi16Nsw9jDwGPNb4MI5ibxpQ1TfC8D7e4=; b=JsI8bvXcX7R6r1cJjYzqFIKTu0e8FNs3Y/r3gzGRGhyk5ZAinIqpWXJIf+4sPWQyAJ A+yOLTNabaY9kuU0wQAqSSgVrO2CYGkP5/u7m/rM7eQFUB+zqJv1OVbP/0Ya0fFpyAew X0Tzitw/c8IjTs0chsMDKyC1i94KczyWnjhYdwEEtYzA0VtpCP1Gjx9dDzA8syFZScAe fAO1krS664BQpksL5CJobr3ilQpvKoz5qxlnhw/5/Lplrwzu0M4razE/F6wlwJTsQ5IE PsmiLBUF7+DjPpupQCFhFVChG5Nc0eJmCAf6jSJnoQLDvbifvRQtYhPn1e+1kYgWzqfn t5jQ== X-Gm-Message-State: AOJu0YxYmRUXB8TN+a46QR/AHtaekBH3sjFJp4xmXi/Uc53KrimsU7SS cNIzyRTTTUPBCGhWYomkh3BpPm7/utww69UA2sjpqgg8mTE93vq0MYo8ECpjYDR3DeU1WxcTldb CxSM= X-Received: by 2002:a5d:58c2:0:b0:346:ba70:f261 with SMTP id o2-20020a5d58c2000000b00346ba70f261mr952868wrf.2.1712832234836; Thu, 11 Apr 2024 03:43:54 -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 t7-20020adfe447000000b00343eac2acc4sm1461921wrm.111.2024.04.11.03.43.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 11 Apr 2024 03:43:54 -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?= , "Edgar E. Iglesias" Subject: [PATCH 2/9] disas/microblaze: Replace sprintf() by snprintf() Date: Thu, 11 Apr 2024 12:43:33 +0200 Message-ID: <20240411104340.6617-3-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é Reviewed-by: Edgar E. Iglesias --- disas/microblaze.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/disas/microblaze.c b/disas/microblaze.c index 0b89b9c4fa..49a4c0fd40 100644 --- a/disas/microblaze.c +++ b/disas/microblaze.c @@ -600,7 +600,8 @@ static char * get_field (long instr, long mask, unsigned short low) { char tmpstr[25]; - sprintf(tmpstr, "%s%d", register_prefix, (int)((instr & mask) >> low)); + snprintf(tmpstr, sizeof(tmpstr), "%s%d", register_prefix, + (int)((instr & mask) >> low)); return(strdup(tmpstr)); } @@ -608,7 +609,8 @@ static char * get_field_imm (long instr) { char tmpstr[25]; - sprintf(tmpstr, "%d", (short)((instr & IMM_MASK) >> IMM_LOW)); + snprintf(tmpstr, sizeof(tmpstr), "%d", + (short)((instr & IMM_MASK) >> IMM_LOW)); return(strdup(tmpstr)); } @@ -616,7 +618,8 @@ static char * get_field_imm5 (long instr) { char tmpstr[25]; - sprintf(tmpstr, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW)); + snprintf(tmpstr, sizeof(tmpstr), "%d", + (short)((instr & IMM5_MASK) >> IMM_LOW)); return(strdup(tmpstr)); } @@ -624,7 +627,8 @@ static char * get_field_rfsl (long instr) { char tmpstr[25]; - sprintf(tmpstr, "%s%d", fsl_register_prefix, (short)((instr & RFSL_MASK) >> IMM_LOW)); + snprintf(tmpstr, sizeof(tmpstr), "%s%d", fsl_register_prefix, + (short)((instr & RFSL_MASK) >> IMM_LOW)); return(strdup(tmpstr)); } @@ -632,7 +636,8 @@ static char * get_field_imm15 (long instr) { char tmpstr[25]; - sprintf(tmpstr, "%d", (short)((instr & IMM15_MASK) >> IMM_LOW)); + snprintf(tmpstr, sizeof(tmpstr), "%d", + (short)((instr & IMM15_MASK) >> IMM_LOW)); return(strdup(tmpstr)); } @@ -641,7 +646,8 @@ static char * get_field_unsigned_imm (long instr) { char tmpstr[25]; - sprintf(tmpstr, "%d", (int)((instr & IMM_MASK) >> IMM_LOW)); + snprintf(tmpstr, sizeof(tmpstr), "%d", + (int)((instr & IMM_MASK) >> IMM_LOW)); return(strdup(tmpstr)); } #endif @@ -653,7 +659,8 @@ get_field_unsigned_imm (long instr) { char tmpstr[25]; - sprintf(tmpstr, "%s%s", register_prefix, (((instr & IMM_MASK) >> IMM_LOW) & REG_MSR_MASK) == 0 ? "pc" : "msr"); + snprintf(tmpstr, sizeof(tmpstr), "%s%s", register_prefix, + (((instr & IMM_MASK) >> IMM_LOW) & REG_MSR_MASK) == 0 ? "pc" : "msr"); return(strdup(tmpstr)); } @@ -709,7 +716,7 @@ get_field_special(long instr, const struct op_code_struct *op) default : { if ( ((((instr & IMM_MASK) >> IMM_LOW) ^ op->immval_mask) & 0xE000) == REG_PVR_MASK) { - sprintf(tmpstr, "%s%u", pvr_register_prefix, + snprintf(tmpstr, sizeof(tmpstr), "%s%u", pvr_register_prefix, (unsigned short)(((instr & IMM_MASK) >> IMM_LOW) ^ op->immval_mask) ^ REG_PVR_MASK); return(strdup(tmpstr)); @@ -720,7 +727,7 @@ get_field_special(long instr, const struct op_code_struct *op) break; } - sprintf(tmpstr, "%s%s", register_prefix, spr); + snprintf(tmpstr, sizeof(tmpstr), "%s%s", register_prefix, spr); return(strdup(tmpstr)); }