Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4612681iob; Sun, 8 May 2022 19:12:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8ih/mZ/pG+cVlB7TwA+T8WpnVuf7BRqtUDC/uKpSUAGbGZ+mO463kv8cuWo2qpCopyoIy X-Received: by 2002:a17:902:eb85:b0:15e:bf29:bd9f with SMTP id q5-20020a170902eb8500b0015ebf29bd9fmr13972449plg.135.1652062379525; Sun, 08 May 2022 19:12:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652062379; cv=none; d=google.com; s=arc-20160816; b=Tb5IpZAHDwO5/jAYnc3uz2cimhjDJIN4v+s+Mpmifxj8uRGVscNA9aSVC8cnkTznAo 7OiMYL70z4tIM9weV6nBFeMJzPfSQPa3uTu0MnFdoiOGee0GOrknzQDgxJCkO5ytwuj0 mjIR44Bx8+qkyvMKoKBJW1lUvZwqGGB4Fe5fpjHELn9ldq4KEZLSCaP8nhfQv7xAVxOX v2iv401vPclj4FqElRkQz/ELpM9havahLIwRJTRJGP2OLs1o8fhPqs8RIdMCeYh6oy2V rUGyF3EiXtK1ZoelXqfx3kSZJ8FAQviLV4J6+RpPyna1VL3XGIxELC0FRKJN44haLuqE rHdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OY+nHI0YO6kQCBNTlVRD8FLakJgR/zoriqgGdSPfjBU=; b=prIazmpyjTlNExxd+BjDHmXLqgzIUskR8Db6zp18kOprhSIVFYiuMPgYqUbEFGDRTp EQmrnBH1i3obMEQL0KS925fJSgrUZg1T7A7upSwcWW3RUd+uGnlvDWN/GaZ7ZONiUiVL ta8HjfBt3IWQ+/DcVKhGVLrsUHDnx4aPdhqoZoRZBA6EmE5/rkC2DoaHa3lmxHGy8xBP 0F2rTDBgPwxaN6iA5op08qz6yS9RuZpxVuIfo7drzi9dvcHsFseiqCNNqPJtTKSMtz4r Kii757iQwxkv9Jr9p2uhfaBotWueiR7cVRB2qS3agaCSXrf2D9YCWVdkm1RdPprD57+o Jk9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=EJMfnS5L; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s7-20020a170902b18700b00153b2d16554si9110397plr.348.2022.05.08.19.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 19:12:59 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=EJMfnS5L; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A7AD5527DF; Sun, 8 May 2022 19:12:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239449AbiEHTHT (ORCPT + 99 others); Sun, 8 May 2022 15:07:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238209AbiEHR1t (ORCPT ); Sun, 8 May 2022 13:27:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06DF8DED0 for ; Sun, 8 May 2022 10:23:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9512A6127C for ; Sun, 8 May 2022 17:23:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83812C385AC; Sun, 8 May 2022 17:23:57 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="EJMfnS5L" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1652030636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OY+nHI0YO6kQCBNTlVRD8FLakJgR/zoriqgGdSPfjBU=; b=EJMfnS5LiNVA/YwaUPsNY3gMvEgWOytlhQ/WJAOcmR7VyX529vbsns7pecoytsnFpvM0q0 ceFFJFF4cszAQsPLECUOcrb4TQ5kzW2rNPiKob/CF4XfiygclPjFfZAshzt4krQPLfEYwn /6o0LL0tkoAYrQLNJHwcpof4RC9ut38= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 3cffb8ff (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Sun, 8 May 2022 17:23:55 +0000 (UTC) Date: Sun, 8 May 2022 19:23:52 +0200 From: "Jason A. Donenfeld" To: Joe Perches Cc: linux-kernel@vger.kernel.org, Dominik Brodowski Subject: Re: [PATCH] random: use symbolic constants for crng_init states Message-ID: References: <20220508112609.138889-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 08, 2022 at 05:57:18AM -0700, Joe Perches wrote: > > diff --git a/drivers/char/random.c b/drivers/char/random.c > [] > > @@ -72,16 +72,16 @@ > [] > > -/* Various types of waiters for crng_init->2 transition. */ > > +static enum { > > + CRNG_EMPTY = 0, /* Little to no entropy collected */ > > + CRNG_EARLY = 1, /* At least POOL_EARLY_BITS collected */ > > + CRNG_READY = 2 /* Fully iniitalized with POOL_READY_BITS collected */ > > typo: initialized Thanks, will do. > > > enum { > > POOL_BITS = BLAKE2S_HASH_SIZE * 8, > > - POOL_INIT_BITS = POOL_BITS, /* No point in settling for less. */ > > - POOL_FAST_INIT_BITS = POOL_INIT_BITS / 2 > > + POOL_READY_BITS = POOL_BITS, /* When crng_init->CRNG_READY */ > > + POOL_EARLY_BITS = POOL_READY_BITS / 2 /* When crng_init->CRNG_EARLY */ > > Seems odd to use a divisor with an enum Why? The constants are defined in terms of other constants. Jason