From patchwork Fri Mar 15 03:26:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160376 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp16268507jad; Thu, 14 Mar 2019 20:42:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaqGfBwxva3cHdy5iQt9mxvZ5Xg1Xq+irQ8JHdN+/99O+74lLWG9ylnUqQE26MiHLdTyXx X-Received: by 2002:adf:c082:: with SMTP id d2mr721950wrf.55.1552621337004; Thu, 14 Mar 2019 20:42:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552621337; cv=none; d=google.com; s=arc-20160816; b=H67qOMh7goZqCK3VS62iL+nyNyeWlGGsWwREl9Htlp3XpLiwSrbhJb/7GU4JY7ZwJC SUbTU62aNWPQDQVKL0iEy/HkPd8DPa0ztpugbr3JG8010USxjzrvasQPl7zNXC6P90Uu 2b4Ft6sFlsdL2OOgOcnT6gCpKcta0avQT6EimhbUt3/lCneeA6JeXy3LWr50f+OslJK0 Mx6rUuogEADrhveUiwm7LAz3XGwv5aaCqjx2lqdIF28QSnUN4/7nQJb3ROQbOcSF/CmM NZQVtlaN1cz1BSHj9lrFkuvlNJ0lr5Hm7vZj2xT9wcFpKBaC2JVq/SPndiOVdXTxG/nn KlzA== 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=XMJVRmxir4vbfLAyTItoiDoux1wKrsQiL1gSDEPlj4M=; b=DrbP7yomlmGyYK66dIctrvOZjyVvukAw3CyVFYV1etRPrujiB7t+A4rVhGcvC1s1kx JQuEyocd86HiepLWn2iqOmrhd1EBM1lIMlustYvAfyLnYKvaYM0pql53zRvHRWZJU9RZ OVipJyJwdLtauNqy75yum0UrxfJhj8464vtY3frZc0i2R+Fe0zi+WnWuygVmBW+sToaK nM5JFaR0njVFDunhsv54WOHXOIkWgNns/59YeLnt9AAPq5rWZmSNwSt6hpHx/fFHnmCn 3lvT86ahyrUso8LOauyKqwc0PvAkliISzCOC8EFzOgGyes2BivKhs8Io8Rkcj602hqw8 LXiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SjjUwj0D; 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 y7si478437wro.195.2019.03.14.20.42.16 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 14 Mar 2019 20:42:16 -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=SjjUwj0D; 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]:48791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4djb-0002iJ-Sm for patch@linaro.org; Thu, 14 Mar 2019 23:42:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4dcJ-00059t-MU for qemu-devel@nongnu.org; Thu, 14 Mar 2019 23:34:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4dUk-00031F-9V for qemu-devel@nongnu.org; Thu, 14 Mar 2019 23:26:55 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:41866) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h4dUk-00030S-3a for qemu-devel@nongnu.org; Thu, 14 Mar 2019 23:26:54 -0400 Received: by mail-pg1-x52b.google.com with SMTP id k11so5397726pgb.8 for ; Thu, 14 Mar 2019 20:26:54 -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=XMJVRmxir4vbfLAyTItoiDoux1wKrsQiL1gSDEPlj4M=; b=SjjUwj0DUmXlWaQVjmBAR0mLmUigqY+iu0LKulaVGDW1cO5tt636tS3ngti7U0o9p7 t05Mg6hSUUtT5wmQxwaH/RLWz/nQCUguWfHZUTt/wwF/lGiRCscOJZiEfuOXcFXKtXfY uTmbMz/T0/T31NB/LGm4BgV9TBD+myO75R6aLuPFl0OzIPsQynZxDoe89z7XlzitgEep bOPHbBcczF1v+bCtKH/cqlWCvg4QH0/uwQPIEZKPDqvXn4ApDXzCtyDPjJHbIXoZYSMZ besBzNAhJgSRXgQfAM/bvfOX/U5pipTxmMcS6zPIgQef3UafpnoB6gDMnzWWzwqIVWo2 8aqw== 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=XMJVRmxir4vbfLAyTItoiDoux1wKrsQiL1gSDEPlj4M=; b=UoG4APrCYOiLueBuJZYoU/3d9vqJgojzAX0/R695FvGLjtmXheyEEJT3ikq0phfdas z/XWKVe3oiRpihWBIvkwja76koDo915LusykXUL6D041UUX9mEapWEVLqciI3+jyo9xp OXRFXCpo4JX+hU4Fmqz12743pFOp4dKzO8BWmMTms0Ak5dABL+jiowt5Ayj/BaJHqLXi z+0cI1/LOez4opUsfWkT4TZ0IsBlqzb/3dof87h9WLGQlclrob7pVrJkmiklYFNWhXpr nHviQjn2AbGeig0Yr9yNGaEHb4S0Gvv5WrIGsG0tX8e/TuOOd0XLAd1kw62+83MHInp1 z2Aw== X-Gm-Message-State: APjAAAXWPbq4rEcUH6zpO6XIAqz6Cn5SmoH0oreLhJ7cLucA1vPSUktt WT7uXZTP5ohETmBH9RsnEyxpcqELsVw= X-Received: by 2002:a17:902:421:: with SMTP id 30mr1809917ple.142.1552620412804; Thu, 14 Mar 2019 20:26:52 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-188-82.tukw.qwest.net. [97.113.188.82]) by smtp.gmail.com with ESMTPSA id d26sm690816pfn.86.2019.03.14.20.26.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Mar 2019 20:26:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 14 Mar 2019 20:26:22 -0700 Message-Id: <20190315032629.21234-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190315032629.21234-1-richard.henderson@linaro.org> References: <20190315032629.21234-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::52b Subject: [Qemu-devel] [PATCH v3 16/23] 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, =?utf-8?b?Q8Op?= =?utf-8?q?dric_Le_Goater?= , Joel Stanley 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: Cédric Le Goater Cc: Andrew Jeffery Cc: Joel Stanley Signed-off-by: Richard Henderson --- hw/misc/aspeed_scu.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) -- 2.17.2 Reviewed-by: Joel Stanley Reviewed-by: Cédric Le Goater Reviewed-by: Philippe Mathieu-Daudé 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; }