divide by zero in random/taviso()

Vince Weaver <[email protected]>
Newsgroups org.kernel.vger.trinity
Message-ID <[email protected]>
Hello

so for my perf_fuzzer I re-use the trinity random.c, and today I hit

[ 1241.026870] traps: perf_fuzzer[4509] trap divide error ip:40a779 

which maps to the taviso() routine which is doing:

           case 1: r = rand() % rand();
#if __WORDSIZE == 64
                r <<= 32;
                r |= rand() % rand();
#endif
                break;

which is a divide by zero if rand() returns 0.

Is there a good way to fix this short of a lot of special case checks?

Vince Weaver
[email protected]
http://www.eece.maine.edu/~vweaver/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.