Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347272
b: refs/heads/master
c: 8eb2ffb
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Kosina authored and Theodore Ts'o committed Nov 8, 2012
1 parent 48d68a6 commit dbfe076
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: be5b779ae9ce64ede0a8f4939360b0320bb257e2
refs/heads/master: 8eb2ffbf7be94c546a873540ff952140465125e5
19 changes: 10 additions & 9 deletions trunk/drivers/char/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
bytes = min_t(int, bytes, sizeof(tmp));

DEBUG_ENT("going to reseed %s with %d bits "
"(%d of %d requested)\n",
"(%zu of %d requested)\n",
r->name, bytes * 8, nbytes * 8, r->entropy_count);

bytes = extract_entropy(r->pull, tmp, bytes,
Expand Down Expand Up @@ -856,7 +856,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
spin_lock_irqsave(&r->lock, flags);

BUG_ON(r->entropy_count > r->poolinfo->POOLBITS);
DEBUG_ENT("trying to extract %d bits from %s\n",
DEBUG_ENT("trying to extract %zu bits from %s\n",
nbytes * 8, r->name);

/* Can we pull enough? */
Expand All @@ -878,7 +878,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
}
}

DEBUG_ENT("debiting %d entropy credits from %s%s\n",
DEBUG_ENT("debiting %zu entropy credits from %s%s\n",
nbytes * 8, r->name, r->limit ? "" : " (unlimited)");

spin_unlock_irqrestore(&r->lock, flags);
Expand Down Expand Up @@ -1138,11 +1138,16 @@ random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
if (n > SEC_XFER_SIZE)
n = SEC_XFER_SIZE;

DEBUG_ENT("reading %d bits\n", n*8);
DEBUG_ENT("reading %zu bits\n", n*8);

n = extract_entropy_user(&blocking_pool, buf, n);

DEBUG_ENT("read got %d bits (%d still needed)\n",
if (n < 0) {
retval = n;
break;
}

DEBUG_ENT("read got %zd bits (%zd still needed)\n",
n*8, (nbytes-n)*8);

if (n == 0) {
Expand All @@ -1167,10 +1172,6 @@ random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
continue;
}

if (n < 0) {
retval = n;
break;
}
count += n;
buf += n;
nbytes -= n;
Expand Down

0 comments on commit dbfe076

Please sign in to comment.