diff options
| author | Jason A. Donenfeld <[email protected]> | 2022-10-10 02:44:02 +0000 |
|---|---|---|
| committer | Jason A. Donenfeld <[email protected]> | 2022-11-18 01:15:22 +0000 |
| commit | d247aabd391c3b2fa4f26874ed9136a7a142fcfd (patch) | |
| tree | 636c3d83037b2f9b7c02825a525db79161639f27 /lib/test_vmalloc.c | |
| parent | treewide: use get_random_u32_below() instead of deprecated function (diff) | |
| download | kernel-d247aabd391c3b2fa4f26874ed9136a7a142fcfd.tar.gz kernel-d247aabd391c3b2fa4f26874ed9136a7a142fcfd.zip | |
treewide: use get_random_u32_{above,below}() instead of manual loop
These cases were done with this Coccinelle:
@@
expression E;
identifier I;
@@
- do {
... when != I
- I = get_random_u32();
... when != I
- } while (I > E);
+ I = get_random_u32_below(E + 1);
@@
expression E;
identifier I;
@@
- do {
... when != I
- I = get_random_u32();
... when != I
- } while (I >= E);
+ I = get_random_u32_below(E);
@@
expression E;
identifier I;
@@
- do {
... when != I
- I = get_random_u32();
... when != I
- } while (I < E);
+ I = get_random_u32_above(E - 1);
@@
expression E;
identifier I;
@@
- do {
... when != I
- I = get_random_u32();
... when != I
- } while (I <= E);
+ I = get_random_u32_above(E);
@@
identifier I;
@@
- do {
... when != I
- I = get_random_u32();
... when != I
- } while (!I);
+ I = get_random_u32_above(0);
@@
identifier I;
@@
- do {
... when != I
- I = get_random_u32();
... when != I
- } while (I == 0);
+ I = get_random_u32_above(0);
@@
expression E;
@@
- E + 1 + get_random_u32_below(U32_MAX - E)
+ get_random_u32_above(E)
Reviewed-by: Kees Cook <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Jason A. Donenfeld <[email protected]>
Diffstat (limited to 'lib/test_vmalloc.c')
0 files changed, 0 insertions, 0 deletions
