From patchwork Tue Jun 4 09:55:44 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: 801385 Delivered-To: patch@linaro.org Received: by 2002:a5d:65c4:0:b0:35b:5a80:51b4 with SMTP id e4csp2312547wrw; Tue, 4 Jun 2024 02:57:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUGFrMMwFK10nn+EtE4ZgwdDlBbvGiuu/pUloVT0zSEuglrMVftd489UJqSrJEPeCRV0W+sjOuxzQZ5+Zna8adE X-Google-Smtp-Source: AGHT+IHJPr5MzstgpOCjthfQF2XkjHCnww+YRFZj4FoN5wVKmCUbJ4kKDEMCCILT/bT34fgmSaJZ X-Received: by 2002:a25:ab03:0:b0:df2:43dd:f7a3 with SMTP id 3f1490d57ef6-dfa73dd9f82mr9884703276.58.1717495072233; Tue, 04 Jun 2024 02:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717495072; cv=none; d=google.com; s=arc-20160816; b=VySN8qacq7MshYDM+GQSs7qE1guPoFp4fm8YiqFadHAJ2mFtNKO5iNbQ/xTM2ttp0b KE6FxwKVRkmwwYlCOyDOuwTAtstuELcar9E4tB58U7ja/b6xAC5puIa6b/xVAGIs8Xus fmFcIiA64PVkljKlrmncGhQpvogeUE0cXxVfN4P/wXxpjeGwvgebzccO6jYLhdXQddJy HS2Hq/8kt2LNaK8aSiOWECqndsZvs2Nv7/4G384yFv7T2fKkZDjN54dcsRJ8yV6IxPu/ lAp9XtXQAY3Acfl8UOY+9Izq5DWjyybj0l7ARxAYhNUVqtYilNkRzTEqwoFNUuOqb1N2 3H/w== 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=vkD3w3/QnVGpH+/ZIlaZduOawYbzu0aNROx1qgMgywQ=; fh=nuLcmdoM5HdxtZ3r6IkqL7j42pSc6N/debEOXY9ID2w=; b=orSDb4MSerwbFCyhupbhVv8N/eseyTQW/NshLu/Kmxn1EEiWT6CeJTnpktkTFYijSa zaF8PCMfjlNsJ/nKEB031ldbjVNdnAHs8PhtqwecZAmBWdQ+SIPCBdhPqgFzCGrscfYC u44v23Or7x2gCjvAoXOPth2wsyrtw8Gqn1d0MFMftQIBqI1xtZBs9DmInN7rFKbXuGWd OpnRYns+g3GpaXQGfil2O0r6OD1BNUrIiyWW0pNyE6vZoz8PnynJ7+3Npa5FIkzY5Pa8 jvmF+070qZReu5u9M2LdVysdA4iay8FoEg2Zqx7gO3EpWxKKLoqpdLAGGVeKmSQ47f9Q dRiQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Bil//0OE"; 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 d75a77b69052e-4401c1657cdsi15268531cf.259.2024.06.04.02.57.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Jun 2024 02:57:52 -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="Bil//0OE"; 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 1sEQua-0005ZY-8D; Tue, 04 Jun 2024 05:57: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 1sEQuY-0005Z3-SO for qemu-devel@nongnu.org; Tue, 04 Jun 2024 05:56:58 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sEQuW-000261-TH for qemu-devel@nongnu.org; Tue, 04 Jun 2024 05:56:58 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-35dcd5377c4so4442046f8f.2 for ; Tue, 04 Jun 2024 02:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717495015; x=1718099815; 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=vkD3w3/QnVGpH+/ZIlaZduOawYbzu0aNROx1qgMgywQ=; b=Bil//0OEsxsi3lJxCzD/CQy/kMLOEWmdTK4Sb56Hh4jH1rfKudFg8dPYwK6c49ggXN k4WAVSyy8+1SxT2vVIhYG0upm2007afc1BMBUwcALs3mX4ZdRcLzzTz4pcQDnE0ALT6s 7VBCr3xcm2A3FgE6y4eNFevxebPLC0CCu7XKqeuYyOCDXvsRAgx7oHNt0ZyJUTYiIotN J3p6LQ+N+rn6AvuQs4JuG04jvd06ia/SA0KJ0hn47p8Xpej+qB0BB8EcG2cHQMOuDyur vH/mDex5DZ4Z9WG5a+KFCXFvWL0FjizuCUIlA4DoPPm1MFCMv/KHJkT0zQFFQbcPz5Z1 xkwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717495015; x=1718099815; 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=vkD3w3/QnVGpH+/ZIlaZduOawYbzu0aNROx1qgMgywQ=; b=r26JDxFYeOYCvEvVdm+d1XIAonN5h14WW8gzvPxmFX16eKPpbFptbZ2wLpRgKlxGM9 QdoqrMyp/D615SMQXaQDRa1Ie4yzJISdRh5iVMCSmx1y22SlyBqnXKRfRNWq7PQZKfk3 T6cRf1cji/Qs+a2yy5bX4NEve8dVMK9F0aLN1eNdNbaV2SP2EQunR2zpFtkSGl5HKcQe 2I3qIn0KhZSX9/HFxDiTurHVha2IkBQLnQTyPSVB8e2AHszWDPHL2Bb1tHa+cjx3QPFK f4pQ4iEt6P8W5qtcvoZlnAohhUAMsnpGazZ85yA3Wfz3Zgvn8lHydq5zghhBXg2ISlDh aAlg== X-Gm-Message-State: AOJu0Ywc00+NC0cAy+tZyRjEQwmN++NF3biASGzC8QQrB0vKeo9rwMCD autmz33Vg3LmMQD+wiQuTGajOsgSHM0hRTWYEdQwpnB+m0nUml60bXsflU+6wfc5XLKSpvd2RHM Q X-Received: by 2002:a5d:484f:0:b0:354:e22d:c7da with SMTP id ffacd0b85a97d-35e0f2a9ab0mr8195900f8f.39.1717495015110; Tue, 04 Jun 2024 02:56:55 -0700 (PDT) Received: from m1x-phil.lan ([176.176.159.34]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35dd066b47asm10972385f8f.112.2024.06.04.02.56.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 04 Jun 2024 02:56:54 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" , Richard Henderson Subject: [PULL 08/32] disas/microblaze: Replace sprintf() by snprintf() Date: Tue, 4 Jun 2024 11:55:44 +0200 Message-ID: <20240604095609.12285-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240604095609.12285-1-philmd@linaro.org> References: <20240604095609.12285-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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 Message-Id: <20240411104340.6617-3-philmd@linaro.org> Signed-off-by: Richard Henderson --- 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)); }