[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH 2/2] lib/ukswrand: Fix uk_swrand_fill_buffer to fill the entire buffer
On 15.10.19 14:09, Simon Kuenzer wrote: On 15.10.19 13:57, Vlad-Andrei BĂDOIU (78692) wrote:uk_swrand_fill_buffer fills only 1 byte per step. We fix this by casting the buffer to __u32 *. Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx> --- lib/ukswrand/mwc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ukswrand/mwc.c b/lib/ukswrand/mwc.c index 21c91f3a..f12b4290 100644 --- a/lib/ukswrand/mwc.c +++ b/lib/ukswrand/mwc.c @@ -98,7 +98,7 @@ ssize_t uk_swrand_fill_buffer(void *buf, size_t buflen) chunk_size = buflen % step; for (i = 0; i < buflen - chunk_size; i += step) - *((char *) buf + i) = uk_swrand_randr(); + *(__u32 *)((char *) buf + i) = uk_swrand_randr();Are you sure this is doing what you wanted? You still increase i byte for byte... ;-) Oh sorry - I was wrong. step is initalized with the sizeof(__u32). All fine ;-). /* fill the remaining bytes of the buffer */ if (chunk_size > 0) {Thanks, Simon _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |