From patchwork Fri Jul 17 10:51:37 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: 235691 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1584474ilg; Fri, 17 Jul 2020 03:56:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWKYUKSUeJ3bvIWWzN0aJW76Z7rTe5Fo7XKaexuIdJyDD77lC1pzLNIMu9xmF8XVnIA/aU X-Received: by 2002:a25:ab0e:: with SMTP id u14mr13716596ybi.181.1594983363892; Fri, 17 Jul 2020 03:56:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594983363; cv=none; d=google.com; s=arc-20160816; b=LzcdcwPJ16YyJ+p9PdWPigeik5zyHAEF7gRn/5cZ+ETZ+KSDIXSwAc2eoJbMScnWKn khcXCU7w6qYCISatwyukKztgXAPrZmbho0lPqdyrHCom8aLrCY40yaTcoADCoUGIkzT9 BBTvpRmsnZsaBhdE1ufhJbtXiS2WbfsUJ8k+bcEBfv41CugVuX3TI0r91e4lWOgk+hZi Pg3aqIP3Q0aMwAR1lYuh9vkxhxMAwhDvlaTu7WEN1OAiDG3U1IGU3yozBwgMsS9sAsy1 c8XccgsbU3wjYbvSW/lMpX2Bkv7UlomXjAr/Y6JgcbKjYuClic0wF/erqA/JWTZG9lzb Qgog== 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=x6Qu/8ZzxFPQUproM48qagEF+BvBJ1cNZWgjUdSHRNw=; b=k4Qx270gs8RpYgu9XCizTjBkZHiCF0U4kO8KcjMLPL+whN8czpiSu7F63lyrfrMVXb +TVw+VNenLHE2uX8LIVIPDugiMhd9DqK/JhPJMWH/c5WbRM+zmiU+hbxbaJ3uoyiWLnY GUPvTv2oZI0/JOAxjzS1XnP5WhpYeUHWE9GJhJxU/5YASuU/vWhL+0MtBxbeoiM+qWpv 33x671wjvxqRLCSAxztBQLYqwHn5al2+Y5q93qdmD4kJLlk4A8SxyrwVgt2+oL6T7T0V 2JywkAq+OPXckXRF/1RszHmfideNHhcbQysGdIrquf3YWCzWdAN/2P1kinhjyiwVzGaD IbLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bys4P6c6; 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 z9si8130434ybk.153.2020.07.17.03.56.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 Jul 2020 03:56:03 -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=bys4P6c6; 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]:51656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwO27-0002bh-AG for patch@linaro.org; Fri, 17 Jul 2020 06:56:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwNy7-0004dF-0Z for qemu-devel@nongnu.org; Fri, 17 Jul 2020 06:51:55 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:35631) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jwNy4-0003s1-B0 for qemu-devel@nongnu.org; Fri, 17 Jul 2020 06:51:54 -0400 Received: by mail-wr1-x42a.google.com with SMTP id z2so10539504wrp.2 for ; Fri, 17 Jul 2020 03:51:47 -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=x6Qu/8ZzxFPQUproM48qagEF+BvBJ1cNZWgjUdSHRNw=; b=bys4P6c6EdCnXc8njtPUgz7H36Mcb+WZk0Y855tSXOjCTjQN0O41mWGtFzuFg0Oo3b LcCXfZLH5YGhXEtkphRRmiJVF+8I/6+2xfVAf5QVPM6sMQg4TMUx5wkglk7KPvsMGJer 7kCAoVWKJPRyr+Hw5g24Bd/24trj/f+N9g9rfkEKdvuXHxsj90Jy8SQ5eg6o5njMwzHT ygnpJ2ko7e3PWKLOtFygaQUETGdlNOQXN1r1vgkn6trOL9AuCrRM7nLc0VUUjrSW2Nsa RMh7AXpRJjTa7neHyqx290TUn1zUX6jot6oK5fmzmJO/8RFPPmRpeg76apLXF1372bKy Pumw== 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=x6Qu/8ZzxFPQUproM48qagEF+BvBJ1cNZWgjUdSHRNw=; b=XCgdOfd/MZPkf6MyBYAq8E6dxIz/UqHz8rJP0jPBwE53EIfcwONIacOpm9leN9vGm5 z9ZwUHUUMydaLggYg38nKdBvL6u4xZeCD45oiaXWkvN3OYbvgKduqMLelN5tl/lrYOvh 8O4mgUVSEOugkc8G1E6NebOpMDOTS+tIwncXVJsqeGBw/Lh4UVuCiIv/uTKyyTPO0BpQ cumGcZSf+/D3wEtxLF8dKODXo/IjKt2p+0EmL1X55vTCSu5SwtIAdc9Ky98NJ1fuRkEA psWZoaFN53mKXWxdnfBIkP+b4pepvlh75U+jNr8Rgm8F3prh5+qoR2ZiuZYrQY+awZFy gicQ== X-Gm-Message-State: AOAM531+sJdzKgXVjcPy3y6XyhdBvKsXAptcNejlteBUbuq+Z6bm2uEC aTs4Dk00BlDXfv2leX2Rb+iQug== X-Received: by 2002:adf:efcc:: with SMTP id i12mr9520799wrp.349.1594983106576; Fri, 17 Jul 2020 03:51:46 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id g3sm15570518wrb.59.2020.07.17.03.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 03:51:43 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D4FE91FF8F; Fri, 17 Jul 2020 11:51:39 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 3/5] semihosting: don't send the trailing '\0' Date: Fri, 17 Jul 2020 11:51:37 +0100 Message-Id: <20200717105139.25293-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200717105139.25293-1-alex.bennee@linaro.org> References: <20200717105139.25293-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42a.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é Message-Id: <1592215252-26742-2-git-send-email-frederic.konrad@adacore.com> --- hw/semihosting/console.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.20.1 Reviewed-by: Richard Henderson 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,