mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Eric Biggers <ebiggers@kernel.org>, linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Om Prakash Singh <quic_omprsing@quicinc.com>,
	Bjorn Andersson <quic_bjorande@quicinc.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	linux-arm-msm@vger.kernel.org,
	Olivia Mackall <olivia@selenic.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH 2/4] crypto: qcom-rng - Allow zero as a random number
Date: Mon, 8 Jun 2026 09:57:29 +0200	[thread overview]
Message-ID: <f2dc655c-8698-4db7-a18f-069f215f011f@oss.qualcomm.com> (raw)
In-Reply-To: <20260530020332.143058-3-ebiggers@kernel.org>

On 5/30/26 4:03 AM, Eric Biggers wrote:
> Zero is a valid random number and needs to be allowed.  Otherwise the
> output is distinguishable from random.
> 
> Fixes: f29cd5bb64c2 ("crypto: qcom-rng - Add hw_random interface support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> ---
>  drivers/crypto/qcom-rng.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c
> index f31a7fe07ba7..b7f3b9695dac 100644
> --- a/drivers/crypto/qcom-rng.c
> +++ b/drivers/crypto/qcom-rng.c
> @@ -63,13 +63,10 @@ static int qcom_rng_read(struct qcom_rng *rng, u8 *data, unsigned int max)
>  					 200, 10000);
>  		if (ret)
>  			return ret;
>  
>  		val = readl_relaxed(rng->base + PRNG_DATA_OUT);
> -		if (!val)
> -			return -EINVAL;
> -

nit: in case you respin, please keep the \n between the read and the
following checks

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

>  		if ((max - currsize) >= WORD_SZ) {
>  			memcpy(data, &val, WORD_SZ);
>  			data += WORD_SZ;
>  			currsize += WORD_SZ;
>  		} else {

  parent reply	other threads:[~2026-06-08  7:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-30  2:03 [PATCH 0/4] qcom-rng fixes and cleanups Eric Biggers
2026-05-30  2:03 ` [PATCH 1/4] crypto: qcom-rng - Enable clock in hwrng case Eric Biggers
2026-06-07 20:51   ` Dmitry Baryshkov
2026-06-08  7:56   ` Konrad Dybcio
2026-05-30  2:03 ` [PATCH 2/4] crypto: qcom-rng - Allow zero as a random number Eric Biggers
2026-06-07 20:52   ` Dmitry Baryshkov
2026-06-08  7:57   ` Konrad Dybcio [this message]
2026-05-30  2:03 ` [PATCH 3/4] crypto: qcom-rng - Remove crypto_rng interface Eric Biggers
2026-06-04  4:50   ` Neeraj Soni
2026-06-04  5:42     ` Eric Biggers
2026-06-07 21:04   ` Dmitry Baryshkov
2026-05-30  2:03 ` [PATCH 4/4] hwrng: qcom - Move qcom-rng.c into drivers/char/hw_random/ Eric Biggers
2026-06-07 21:04   ` Dmitry Baryshkov
2026-06-08  7:59     ` Konrad Dybcio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f2dc655c-8698-4db7-a18f-069f215f011f@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=ebiggers@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olivia@selenic.com \
    --cc=quic_bjorande@quicinc.com \
    --cc=quic_omprsing@quicinc.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®