Merge tag 'ieee802154-for-net-next-2022-10-25' of git://git.kernel.org/pub/scm/linux...
[linux-2.6-microblaze.git] / fs / ubifs / debug.c
index fc718f6..3f128b9 100644 (file)
@@ -2467,7 +2467,7 @@ error_dump:
 
 static inline int chance(unsigned int n, unsigned int out_of)
 {
-       return !!((prandom_u32() % out_of) + 1 <= n);
+       return !!(prandom_u32_max(out_of) + 1 <= n);
 
 }
 
@@ -2485,13 +2485,13 @@ static int power_cut_emulated(struct ubifs_info *c, int lnum, int write)
                        if (chance(1, 2)) {
                                d->pc_delay = 1;
                                /* Fail within 1 minute */
-                               delay = prandom_u32() % 60000;
+                               delay = prandom_u32_max(60000);
                                d->pc_timeout = jiffies;
                                d->pc_timeout += msecs_to_jiffies(delay);
                                ubifs_warn(c, "failing after %lums", delay);
                        } else {
                                d->pc_delay = 2;
-                               delay = prandom_u32() % 10000;
+                               delay = prandom_u32_max(10000);
                                /* Fail within 10000 operations */
                                d->pc_cnt_max = delay;
                                ubifs_warn(c, "failing after %lu calls", delay);
@@ -2571,7 +2571,7 @@ static int corrupt_data(const struct ubifs_info *c, const void *buf,
        unsigned int from, to, ffs = chance(1, 2);
        unsigned char *p = (void *)buf;
 
-       from = prandom_u32() % len;
+       from = prandom_u32_max(len);
        /* Corruption span max to end of write unit */
        to = min(len, ALIGN(from + 1, c->max_write_size));
 
@@ -2581,7 +2581,7 @@ static int corrupt_data(const struct ubifs_info *c, const void *buf,
        if (ffs)
                memset(p + from, 0xFF, to - from);
        else
-               prandom_bytes(p + from, to - from);
+               get_random_bytes(p + from, to - from);
 
        return to;
 }