1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-19 19:59:43 +00:00

Fix integer type overflow, limiting test range to first 4GB of the media.

Reviewed by:	pjd
This commit is contained in:
Alexander Motin 2014-03-02 18:19:48 +00:00
parent 52b9f5fb3c
commit c58f4b5dbd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=346787
2 changed files with 5 additions and 4 deletions

View File

@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= raidtest
PORTVERSION= 1.2
PORTVERSION= 1.3
CATEGORIES= benchmarks
MASTER_SITES= # none
DISTFILES= # none

View File

@ -113,8 +113,8 @@ write_ioreq(int fd, struct ioreq *iorq)
static void
raidtest_genfile(int argc, char *argv[])
{
uintmax_t i, nreqs, mediasize, nsectors, nbytes, nrreqs, nwreqs;
unsigned secsize, maxsec;
uintmax_t i, nreqs, mediasize, nsectors, nbytes, nrreqs, nwreqs, maxsec;
unsigned secsize;
const char *file = NULL;
struct ioreq iorq;
int ch, fd, flags, rdonly, wronly;
@ -189,7 +189,8 @@ raidtest_genfile(int argc, char *argv[])
iorq.iorq_length = gen_size(secsize);
/* Generate I/O request offset. */
maxsec = nsectors - (iorq.iorq_length / secsize);
iorq.iorq_offset = (arc4random() % maxsec) * secsize;
iorq.iorq_offset = ((((uintmax_t)arc4random() << 32) |
arc4random()) % maxsec) * secsize;
/* Generate I/O request type. */
if (rdonly)
iorq.iorq_type = IO_TYPE_READ;