Browse Source

klondike - avoid division by zero if maxcount is unexpectedly zero

nfactor-troky
Kano 11 years ago
parent
commit
5154e8472d
  1. 3
      driver-klondike.c

3
driver-klondike.c

@ -537,7 +537,8 @@ static int64_t klondike_scanwork(struct thr_info *thr) @@ -537,7 +537,8 @@ static int64_t klondike_scanwork(struct thr_info *thr)
newhashdev += klninfo->status[dev].maxcount; // hash counter wrapped
newhashdev += klninfo->status[dev].hashcount - klninfo->devinfo[dev].lasthashcount;
klninfo->devinfo[dev].lasthashcount = klninfo->status[dev].hashcount;
klninfo->hashcount += (newhashdev << 32) / klninfo->status[dev].maxcount;
if (klninfo->status[dev].maxcount != 0)
klninfo->hashcount += (newhashdev << 32) / klninfo->status[dev].maxcount;
// todo: check stats for critical conditions
}

Loading…
Cancel
Save