Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp774924ybb; Sat, 28 Mar 2020 09:46:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtU9xwY6HgqLdoTVMi3hawwyyaicw306IztJIR0aqQVwzhl2j8hqx7IfYiEBlJ9/cHDVO11 X-Received: by 2002:aca:a882:: with SMTP id r124mr2859888oie.53.1585413963068; Sat, 28 Mar 2020 09:46:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585413963; cv=none; d=google.com; s=arc-20160816; b=QfCA8VzyEamI3ZCGZkeTTAD4iQ8llq2lfFsGgN7dm/t1HYrQ3zIWrPKRevX1A3UHTQ N6uGLYic4Dcj6X8CURm/IrUtQoGKowwn7h92J+/nfdtF2UykX4v036Zhpcfk3LuIhd6q kIzy+ijAyxZLwu7pm+foAskJTCVejGN8kQkSZoMjYZ7jXXRjV0hNydQlnvSbvU8jEg9D F8wbARsY3o+1RRapzuMQUpB4OGNZedc+VEnWyRCc3F8Em7UaXOGEfXSJDaFS5J7N3Fyl Ixz5pIlg/Xo8zj1F3z38YBbI2096GBnE/kojHjmkveR6EZHvo4DtX+cuHELGWj0pZ/x3 KQmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:date:from:message-id; bh=1PD7KD98jZB/e3yDWCcovqvHgNA2Ld3u51H7StuTpAk=; b=Wd3kp5igtinJPVTd3MuMx4nB6BaY2vgEgJ43Jv8snkwRd851viMT8bHkPhMXXiAoa9 xSzcLTpXd/tP9fZYYt0u4dW+mUanP+w16Ci4NlFCY/JzFxAsdPWI8fg8xIws3p2ZijD6 qFzSgDjsIQ+rp/EP01sA3synlvAwI3rP9fYX1CRfoyi2aTYMyGDMRsTEHqxJCxomU+iD BdmsAB9HoIHerRI4me7NvbiU2imnK85UwHqxCSjpGfEXFMI9RpydVQpRLzQ072jc/QDM WrdR+dAj547xA/nrhCc+pYXcLtG7kkEMj+qLJBZYvqYvhWvIi67j31020ta7ir53URcj 44lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h186si802250oob.30.2020.03.28.09.45.50; Sat, 28 Mar 2020 09:46:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727984AbgC1QoO (ORCPT + 99 others); Sat, 28 Mar 2020 12:44:14 -0400 Received: from mx.sdf.org ([205.166.94.20]:49806 "EHLO mx.sdf.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727957AbgC1QoN (ORCPT ); Sat, 28 Mar 2020 12:44:13 -0400 Received: from sdf.org (IDENT:lkml@sdf.lonestar.org [205.166.94.16]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 02SGhHat008785 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Sat, 28 Mar 2020 16:43:17 GMT Received: (from lkml@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 02SGhHox023138; Sat, 28 Mar 2020 16:43:17 GMT Message-Id: <202003281643.02SGhHox023138@sdf.org> From: George Spelvin Date: Wed, 20 Mar 2019 22:50:00 -0400 Subject: [RFC PATCH v1 26/50] drivers/nfc/nfcsim: use prandom_32() for time delay To: linux-kernel@vger.kernel.org, lkml@sdf.org Cc: Thierry Escande , Samuel Ortiz , linux-nfc@lists.01.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org get_random_bytes() is expensive crypto-quality seed material. That's not needed for a simple simulation. (Also, a 3-10 ms delay, when converted to jiffies, isn't a lot of granularity. It's 1 jiffy at HZ=100 and 3 jiffies at HZ=250 or HZ=300.) Signed-off-by: George Spelvin Cc: Thierry Escande Cc: Samuel Ortiz Cc: linux-nfc@lists.01.org --- drivers/nfc/nfcsim.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c index a9864fcdfba6b..eb0a909a25487 100644 --- a/drivers/nfc/nfcsim.c +++ b/drivers/nfc/nfcsim.c @@ -229,8 +229,7 @@ static int nfcsim_send(struct nfc_digital_dev *ddev, struct sk_buff *skb, dev->mode); /* Add random delay (between 3 and 10 ms) before sending data */ - get_random_bytes(&delay, 1); - delay = 3 + (delay & 0x07); + delay = 3 + prandom_u32_max(8); schedule_delayed_work(&dev->send_work, msecs_to_jiffies(delay)); } -- 2.26.0