From patchwork Mon May 6 17:33:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163434 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:81:0:0:0:0 with SMTP id l1csp266128ilm; Mon, 6 May 2019 10:48:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8NzNYlqZgxXaft6Q2wiahiN+PlzvgxaC5No0mm345D3mzz1zFv5v9EtC2/T0zwXXAcroF X-Received: by 2002:a5d:4ec6:: with SMTP id s6mr18099062wrv.87.1557164887173; Mon, 06 May 2019 10:48:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557164887; cv=none; d=google.com; s=arc-20160816; b=1CatDtQBbkHDPUUm8MAZYYfL5PM/nqv5SuzeOTWcYqwCrgar6dX3TGEXVToiJFknTW djY5Ozay72+OM68yQ1tNUaOJT0U1Fm55WYC/L0SxCKCfxZK1S2bYEHzyEW/pDkKXzb0b XqOkGqjqtUL0o3VHdpze7wxokpI9L1enRAnXb013N3wH+qAcZ/Hn0pQG2zHzjp0bCjVe czOFBXOQu3Y0ZhIUdOilj/wxkup0H/zVwIxTx/DXOMOKlEsb1jrl8phoLD8lQg36kqjH BEaX9V5CD1liMCbOBtsZfVsFSn9lUn5QRgpAqGUSUX5i8QTEwMR/vzEoUam6LD7M5l2Y aNWw== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=PvlwPcZPY/FWFYh3k49LzzqKgqvSGwd1QF+0Yp8Ixq4=; b=bXAoWMuoq3gRkzx/2JHcA8SATLle17Qy0GKaZQrK7NzSFrxV7lVs5mDASdJRzrkIWL 4oS/obseQUnmRkysx277p2fNH79UmlqzAdZCHQp76MCnv/+dzrckUfso4m0nA84d5/TN 5wzDZxe3IRmCnhWzEUW06Aqa7uuLwIfRCXkB7ZXcuOLhHPeHrXxRpNeZgKigc0SjpKWl Z4Sx5XLEuJmt0GeUV9wB6sMqUJDkmKVZZzKYYTgvpdpWLhi41gHteuPHxrcWEuvAQf1O 1a5M/kE2fLp0C0fmq8kth6Ly/NNTpnxpuOEAW8srAysD1Bciq4bH4VKHOvQR+TwoRGml yJWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=FtmpCYW2; 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 l4si7630445wrr.52.2019.05.06.10.48.06 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 06 May 2019 10:48:07 -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=FtmpCYW2; 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 ([127.0.0.1]:60086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNhig-0005ct-5c for patch@linaro.org; Mon, 06 May 2019 13:48:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNhVO-0001F1-0I for qemu-devel@nongnu.org; Mon, 06 May 2019 13:34:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNhVK-0001St-P7 for qemu-devel@nongnu.org; Mon, 06 May 2019 13:34:20 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:42678) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hNhVK-0001RD-HR for qemu-devel@nongnu.org; Mon, 06 May 2019 13:34:18 -0400 Received: by mail-pf1-x443.google.com with SMTP id 13so6822231pfw.9 for ; Mon, 06 May 2019 10:34:17 -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=PvlwPcZPY/FWFYh3k49LzzqKgqvSGwd1QF+0Yp8Ixq4=; b=FtmpCYW2i5ojok4k2vEbCXHVQi8yP6K+LoxD05vBTGP6vq75Rr8lHdm28xNtI1ZI0u a0G9OW/fI7O5IQuKSpA3guGEmMDdUH21sF11J4eRhjs76Yrp55Roy25FjdjbYRv0CWo5 JFo8CizPG2FVHATM80gGMAmsFljmdbsAhXj9NON++vRlBEBYmkvrfP/XOCUp3cBZpTD1 GcX4okn94qath5pIaWbNh7r09RU+zJj8m23PaCQpKDpFEzrRGw71AjjBSnje0eXiEdvC 773e4TxrfZR5ltJqobbxmuSo3we4hj1v6IlxPLzKEp9qxVW0YO6p6s7G9BkfyaLIBT08 muAw== 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=PvlwPcZPY/FWFYh3k49LzzqKgqvSGwd1QF+0Yp8Ixq4=; b=o2BWax92tK7qkT120zorgOalvVrKxDe6ls/Uzi6+rGxveGuZ+umA/Wsbr6zbUWcfEy nSlBmR5NXvSm0jR8hoG2MHQkXzQcpNEtOUtzNBXI/C13qb8cDREYmz6B0YfsBV1qfXyv QzZph5eLil0MHAZJtujBN9TlQC9d+dXrGImX/SXZ59/VWGO7YYPxcldQlNFwQXEjOW00 oh1pX8ec3PaX6vyZs5IEiTpveMJd+V5ug1aQqQp7fZx3NsPJOD5X+xporRoZyTWoUPKb NBAcUBMN+6SWeHYamMC63BZjx399dh9qkU3o6aHVSvTLFAKp/l1ikrleCMb4k8lHI4Fd n6dw== X-Gm-Message-State: APjAAAXYYkRcPkDER5Mwtgtr0iIDlgcAnO5rlWuaWyEs1tkGn0k35j8l U5SGCpv7uxQkFuRu61AuCq7IdQJb5OQ= X-Received: by 2002:aa7:8243:: with SMTP id e3mr2434449pfn.213.1557164056133; Mon, 06 May 2019 10:34:16 -0700 (PDT) Received: from localhost.localdomain (97-113-189-189.tukw.qwest.net. [97.113.189.189]) by smtp.gmail.com with ESMTPSA id k9sm2268839pfa.180.2019.05.06.10.34.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2019 10:34:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 6 May 2019 10:33:46 -0700 Message-Id: <20190506173353.32206-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190506173353.32206-1-richard.henderson@linaro.org> References: <20190506173353.32206-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH v4 17/24] aspeed/scu: Use qemu_guest_getrandom_nofail X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The random number is intended for use by the guest. As such, we should honor the -seed argument for reproducibility. Use the *_nofail routine instead of rolling our own error handling locally. Cc: qemu-arm@nongnu.org Cc: Andrew Jeffery Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Reviewed-by: Joel Stanley Signed-off-by: Richard Henderson --- hw/misc/aspeed_scu.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) -- 2.17.1 Reviewed-by: Laurent Vivier diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c index c8217740ef..ab1e18ed4b 100644 --- a/hw/misc/aspeed_scu.c +++ b/hw/misc/aspeed_scu.c @@ -16,7 +16,7 @@ #include "qapi/visitor.h" #include "qemu/bitops.h" #include "qemu/log.h" -#include "crypto/random.h" +#include "qemu/guest-random.h" #include "trace.h" #define TO_REG(offset) ((offset) >> 2) @@ -157,14 +157,8 @@ static const uint32_t ast2500_a1_resets[ASPEED_SCU_NR_REGS] = { static uint32_t aspeed_scu_get_random(void) { - Error *err = NULL; uint32_t num; - - if (qcrypto_random_bytes((uint8_t *)&num, sizeof(num), &err)) { - error_report_err(err); - exit(1); - } - + qemu_guest_getrandom_nofail(&num, sizeof(num)); return num; }