From: Jason Gunthorpe <jgg@ziepe.ca>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
"Darrick J . Wong" <djwong@kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
dri-devel@lists.freedesktop.org,
Andrii Nakryiko <andrii@kernel.org>,
Hans Verkuil <hverkuil@xs4all.nl>,
linux-sctp@vger.kernel.org,
"Md . Haris Iqbal" <haris.iqbal@ionos.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Christoph Hellwig <hch@lst.de>,
Andy Gospodarek <andy@greyhouse.net>,
Sergey Matyukevich <geomatsi@gmail.com>,
Rohit Maheshwari <rohitm@chelsio.com>,
Michael Ellerman <mpe@ellerman.id.au>,
ceph-devel@vger.kernel.org,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Jozsef Kadlecsik <kadlec@netfilter.org>,
Nilesh Javali <njavali@marvell.com>,
Jean-Paul Roubelat <jpr@f6fbb.org>,
Dick Kennedy <dick.kennedy@broadcom.com>,
Jay Vosburgh <j.vosburgh@gmail.com>,
Potnuri Bharat Teja <bharat@chelsio.com>,
Vinay Kumar Yadav <vinay.yadav@chelsio.com>,
linux-nfs@vg
Subject: Re: [PATCH v1 3/5] treewide: use get_random_u32() when possible
Date: Thu, 6 Oct 2022 09:47:49 -0300 [thread overview]
Message-ID: <Yz7OdfKZeGkpZSKb@ziepe.ca> (raw)
In-Reply-To: <20221005214844.2699-4-Jason@zx2c4.com>
On Wed, Oct 05, 2022 at 11:48:42PM +0200, Jason A. Donenfeld wrote:
> index 14392c942f49..499a425a3379 100644
> --- a/drivers/infiniband/hw/cxgb4/cm.c
> +++ b/drivers/infiniband/hw/cxgb4/cm.c
> @@ -734,7 +734,7 @@ static int send_connect(struct c4iw_ep *ep)
> &ep->com.remote_addr;
> int ret;
> enum chip_type adapter_type = ep->com.dev->rdev.lldi.adapter_type;
> - u32 isn = (prandom_u32() & ~7UL) - 1;
> + u32 isn = (get_random_u32() & ~7UL) - 1;
Maybe this wants to be written as
(prandom_max(U32_MAX >> 7) << 7) | 7
?
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
> index fd9d7f2c4d64..a605cf66b83e 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
> @@ -465,7 +465,7 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id,
> goto err_qp;
> }
>
> - psn = prandom_u32() & 0xffffff;
> + psn = get_random_u32() & 0xffffff;
prandom_max(0xffffff + 1)
?
Jason
next prev parent reply other threads:[~2022-10-06 12:47 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-05 21:48 [PATCH v1 0/5] treewide cleanup of random integer usage Jason A. Donenfeld via dev
2022-10-05 21:48 ` [PATCH v1 1/5] treewide: use prandom_u32_max() when possible Jason A. Donenfeld via Linux-f2fs-devel
[not found] ` <20221005214844.2699-2-Jason-OnJsPKxuuEcAvxtiuMwx3w@public.gmane.org>
2022-10-06 4:16 ` Kees Cook
2022-10-06 4:22 ` KP Singh
2022-10-06 12:45 ` Jason A. Donenfeld via dev
2022-10-06 12:55 ` Jason Gunthorpe
2022-10-06 13:05 ` Andy Shevchenko
2022-10-05 21:48 ` [PATCH v1 3/5] treewide: use get_random_u32() " Jason A. Donenfeld via Linux-f2fs-devel
2022-10-06 8:43 ` Jan Kara
2022-10-06 12:33 ` [f2fs-dev] " Jason A. Donenfeld via dev
2022-10-06 13:01 ` Andy Shevchenko
2022-10-06 13:07 ` Jason A. Donenfeld via Linux-f2fs-devel
2022-10-06 12:47 ` Jason Gunthorpe [this message]
[not found] ` <Yz7OdfKZeGkpZSKb-uk2M96/98Pc@public.gmane.org>
2022-10-06 13:05 ` Jason A. Donenfeld via dev
2022-10-06 13:15 ` Jason Gunthorpe
2022-10-06 13:20 ` Andy Shevchenko
[not found] ` <20221005214844.2699-4-Jason-OnJsPKxuuEcAvxtiuMwx3w@public.gmane.org>
2022-10-12 19:16 ` Joe Perches
2022-10-12 19:16 ` Joe Perches
[not found] ` <f8ad3ba44d28dec1a5f7626b82c5e9c2aeefa729.camel@perches.com>
[not found] ` <f8ad3ba44d28dec1a5f7626b82c5e9c2aeefa729.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2022-10-12 21:29 ` David Laight
[not found] ` <d45bd258e033453b85a137112e7694e1-1XygrNkDbNvwg4NCKwmqgw@public.gmane.org>
2022-10-13 1:37 ` Joe Perches
2022-10-05 21:48 ` [PATCH v1 4/5] treewide: use get_random_bytes " Jason A. Donenfeld via Linux-f2fs-devel
2022-10-06 4:45 ` Kees Cook
[not found] ` <20221005214844.2699-5-Jason-OnJsPKxuuEcAvxtiuMwx3w@public.gmane.org>
2022-10-06 4:48 ` Kees Cook
[not found] ` <20221005214844.2699-1-Jason-OnJsPKxuuEcAvxtiuMwx3w@public.gmane.org>
2022-10-05 21:48 ` [PATCH v1 2/5] treewide: use get_random_{u8, u16}() " Jason A. Donenfeld via dev
[not found] ` <20221005214844.2699-3-Jason-OnJsPKxuuEcAvxtiuMwx3w@public.gmane.org>
2022-10-06 4:38 ` Kees Cook
2022-10-06 12:28 ` Jason A. Donenfeld via dev
2022-10-05 21:48 ` [PATCH v1 5/5] prandom: remove unused functions Jason A. Donenfeld via dev
[not found] ` <20221005214844.2699-6-Jason-OnJsPKxuuEcAvxtiuMwx3w@public.gmane.org>
2022-10-06 4:39 ` Kees Cook
2022-10-06 4:55 ` [PATCH v1 0/5] treewide cleanup of random integer usage Kees Cook
2022-10-06 5:40 ` Kees Cook
2022-10-06 12:53 ` Jason A. Donenfeld via dev
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=Yz7OdfKZeGkpZSKb@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=Jason@zx2c4.com \
--cc=andrew@lunn.ch \
--cc=andrii@kernel.org \
--cc=andy@greyhouse.net \
--cc=bharat@chelsio.com \
--cc=ceph-devel@vger.kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=dick.kennedy@broadcom.com \
--cc=djwong@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=geomatsi@gmail.com \
--cc=haris.iqbal@ionos.com \
--cc=hch@lst.de \
--cc=hverkuil@xs4all.nl \
--cc=j.vosburgh@gmail.com \
--cc=jpr@f6fbb.org \
--cc=kadlec@netfilter.org \
--cc=linux-nfs@vg \
--cc=linux-sctp@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=mpe@ellerman.id.au \
--cc=njavali@marvell.com \
--cc=rohitm@chelsio.com \
--cc=ulf.hansson@linaro.org \
--cc=vinay.yadav@chelsio.com \
/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