From patchwork Wed Jul 22 06:28:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 246967 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp267295ilg; Tue, 21 Jul 2020 23:30:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZ65MdY/Ueq1kXIrMjHGzWIvN0BWa7jFpE+mjJdXOflm7r2HVhetrBRm1ykTP9BaLsJIt5 X-Received: by 2002:a25:c881:: with SMTP id y123mr44372877ybf.427.1595399402933; Tue, 21 Jul 2020 23:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595399402; cv=none; d=google.com; s=arc-20160816; b=g+bNNBvkjrN1iel0enJeJKmYxm0yeJaFLbts7TfJ/iXnjfRexBYDP2ORBBY9J3BTqd qFFWsnJdPUqfY/GDYxWqO48JbmW0YmVFyv45taHsHoQu0hArvRDyKPbE0X+b8IzeUIaE IHKYtHaZAemdaRExVRwjjp1fg0uCTiJvS+DFFNoK/ZXFgxgckDGL3/cO3uo3hFgmAYkH wPV6Vmg4mRDGfT36pNMGy/X004xOOipj/6isLl/N1Fwt5DQglUSyFuma9EImnnd0MAbJ HPpN/YHAwzwDdxQmoqDG5HOfqo9VPo8IwWCkHBPTE1xD7Ht+CJg7nUPnKJSodZcUViV9 2xmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=FXawODYQMPXkW63coV0jaCgGZ0mloHIJB4WSMUcLFTA=; b=R95VtGc//6W1CmTRttX8ejpmypsgYyu+VmjSO1dD7rgx5nzssHJxvxMVJ2NXf42g6J U2Ajsfw0vG0fOKxFMKS4n5ziITGneCySs5T76aQAswom7zMcbaVFSjIiHr+s2Zw8fhCl V0Z+ifHmR2DQ7MmCX7ssYqjHg3TRfN5EPlcXQcG3rKzB42IJiDInne8k2BVLii9SThOm t1Jl+je2KvS02lB3GsoS5yrfEzchEObr1FDcdZvC0GeAxPhZGxyth6oQfBoN4VdltVWh nz/ks26Zb6LwzInzYMSfVbfeU8n5TW1Z0saJmcPXxm3HO6TCIp0+xxLPfzCzSSHE3g41 FzoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KhwPHa9y; 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=fail (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 p202si22048004yba.240.2020.07.21.23.30.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Jul 2020 23:30:02 -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=fail header.i=@linaro.org header.s=google header.b=KhwPHa9y; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jy8GQ-0007BE-CO for patch@linaro.org; Wed, 22 Jul 2020 02:30:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jy8Fb-00071b-VH for qemu-devel@nongnu.org; Wed, 22 Jul 2020 02:29:11 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:33386) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jy8Fa-0006uM-Gx for qemu-devel@nongnu.org; Wed, 22 Jul 2020 02:29:11 -0400 Received: by mail-wm1-x344.google.com with SMTP id a6so3659828wmm.0 for ; Tue, 21 Jul 2020 23:29:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FXawODYQMPXkW63coV0jaCgGZ0mloHIJB4WSMUcLFTA=; b=KhwPHa9yjKnauoBpSsKJLnF0es/YzqGalAAoPgWCdfqgzK+Z93KpaN8CIXTgKoipid joLQcjIoNVGCZAaLep382LfuDFqvk13i8td7aDE8YF1OGfYg+EX+UmGQ9twfOYvlDnFH RojoGhlXU9xml5AJ+zQLhOUFdhdDMpKrTW+Yms8BZNw7n6xZhNFrfpUNmH6PP5iFnuQK qLMytkcii8r/tWQOD/mrYb8p0FE1v5D39SwWrz57qKu95QjOKJLNQx1DXzO7hdDWu6xG v1jxO5dJWWZCuf0Ql91r9t3tEB42Y/kGtlfiAMFnekTCPaOisGs/cqRZ4BJuP6oB5OPH N9Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FXawODYQMPXkW63coV0jaCgGZ0mloHIJB4WSMUcLFTA=; b=GqVx1a6e1Bma1v9Xw0r3T73MKMsJgd6E2YEn41TCy5YBl8Dw8EoJohp4zLu68hqXoO Yr+WPB1Gswi/WZFJnUMDz6OL+Q1um0eeaPZinYmg/qdZPIPa36r8Mf3MvW7bIFWpg2Kj DPZq4Nb7oAUh2TRIyYv2F/J+PJNgZ/GqC2l4akhX2l1a/uQx3xK7aTim297kjJKoxsaw LERw5F0E6kpiVYswSULcs84qgh7HFlCmIqc1oDPZZbiXrtce77E/gp/M3CDEHhwHmmN2 cWC2n0L48PVbPs16NXQaZBMdMqMGI/kkc9UCV4UvuLfoGMU8ltbpsYVee0UeXiUkT4KE nSWA== X-Gm-Message-State: AOAM532kDyKhSEB0KNY0DdDuil+xRSOEgQicdIpSUZTWAykjxnePU8P7 KtaBZJc8VG7M0VYegWo5LB6Uog== X-Received: by 2002:a1c:f616:: with SMTP id w22mr6837124wmc.44.1595399349155; Tue, 21 Jul 2020 23:29:09 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 60sm15886664wrs.20.2020.07.21.23.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 23:29:03 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 3E4761FF8F; Wed, 22 Jul 2020 07:29:03 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 03/12] semihosting: don't send the trailing '\0' Date: Wed, 22 Jul 2020 07:28:53 +0100 Message-Id: <20200722062902.24509-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200722062902.24509-1-alex.bennee@linaro.org> References: <20200722062902.24509-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, berrange@redhat.com, =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= , KONRAD Frederic , cota@braap.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: KONRAD Frederic Don't send the trailing 0 from the string. Signed-off-by: KONRAD Frederic Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <1592215252-26742-2-git-send-email-frederic.konrad@adacore.com> Message-Id: <20200717105139.25293-4-alex.bennee@linaro.org> --- hw/semihosting/console.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/hw/semihosting/console.c b/hw/semihosting/console.c index 22e7827824a..9b4fee92602 100644 --- a/hw/semihosting/console.c +++ b/hw/semihosting/console.c @@ -52,7 +52,9 @@ static GString *copy_user_string(CPUArchState *env, target_ulong addr) do { if (cpu_memory_rw_debug(cpu, addr++, &c, 1, 0) == 0) { - s = g_string_append_c(s, c); + if (c) { + s = g_string_append_c(s, c); + } } else { qemu_log_mask(LOG_GUEST_ERROR, "%s: passed inaccessible address " TARGET_FMT_lx,