diff options
author | Jiri Kosina <jkosina@suse.cz> | 2012-10-15 17:43:29 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-11-08 07:12:20 -0500 |
commit | 8eb2ffbf7be94c546a873540ff952140465125e5 (patch) | |
tree | a3d60ca8bccc6b611a1bb6f9e9c9d5e85f32e008 | |
parent | be5b779ae9ce64ede0a8f4939360b0320bb257e2 (diff) |
random: fix debug format strings
Fix the following warnings in formatting debug output:
drivers/char/random.c: In function ‘xfer_secondary_pool’:
drivers/char/random.c:827: warning: format ‘%d’ expects type ‘int’, but argument 7 has type ‘size_t’
drivers/char/random.c: In function ‘account’:
drivers/char/random.c:859: warning: format ‘%d’ expects type ‘int’, but argument 5 has type ‘size_t’
drivers/char/random.c:881: warning: format ‘%d’ expects type ‘int’, but argument 5 has type ‘size_t’
drivers/char/random.c: In function ‘random_read’:
drivers/char/random.c:1141: warning: format ‘%d’ expects type ‘int’, but argument 5 has type ‘ssize_t’
drivers/char/random.c:1145: warning: format ‘%d’ expects type ‘int’, but argument 5 has type ‘ssize_t’
drivers/char/random.c:1145: warning: format ‘%d’ expects type ‘int’, but argument 6 has type ‘long unsigned int’
by using '%zd' instead of '%d' to properly denote ssize_t/size_t conversion.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | drivers/char/random.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 9ac4443a185..a1af1839576 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -825,7 +825,7 @@ static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes) | |||
825 | bytes = min_t(int, bytes, sizeof(tmp)); | 825 | bytes = min_t(int, bytes, sizeof(tmp)); |
826 | 826 | ||
827 | DEBUG_ENT("going to reseed %s with %d bits " | 827 | DEBUG_ENT("going to reseed %s with %d bits " |
828 | "(%d of %d requested)\n", | 828 | "(%zu of %d requested)\n", |
829 | r->name, bytes * 8, nbytes * 8, r->entropy_count); | 829 | r->name, bytes * 8, nbytes * 8, r->entropy_count); |
830 | 830 | ||
831 | bytes = extract_entropy(r->pull, tmp, bytes, | 831 | bytes = extract_entropy(r->pull, tmp, bytes, |
@@ -856,7 +856,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, | |||
856 | spin_lock_irqsave(&r->lock, flags); | 856 | spin_lock_irqsave(&r->lock, flags); |
857 | 857 | ||
858 | BUG_ON(r->entropy_count > r->poolinfo->POOLBITS); | 858 | BUG_ON(r->entropy_count > r->poolinfo->POOLBITS); |
859 | DEBUG_ENT("trying to extract %d bits from %s\n", | 859 | DEBUG_ENT("trying to extract %zu bits from %s\n", |
860 | nbytes * 8, r->name); | 860 | nbytes * 8, r->name); |
861 | 861 | ||
862 | /* Can we pull enough? */ | 862 | /* Can we pull enough? */ |
@@ -878,7 +878,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, | |||
878 | } | 878 | } |
879 | } | 879 | } |
880 | 880 | ||
881 | DEBUG_ENT("debiting %d entropy credits from %s%s\n", | 881 | DEBUG_ENT("debiting %zu entropy credits from %s%s\n", |
882 | nbytes * 8, r->name, r->limit ? "" : " (unlimited)"); | 882 | nbytes * 8, r->name, r->limit ? "" : " (unlimited)"); |
883 | 883 | ||
884 | spin_unlock_irqrestore(&r->lock, flags); | 884 | spin_unlock_irqrestore(&r->lock, flags); |
@@ -1138,11 +1138,16 @@ random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | |||
1138 | if (n > SEC_XFER_SIZE) | 1138 | if (n > SEC_XFER_SIZE) |
1139 | n = SEC_XFER_SIZE; | 1139 | n = SEC_XFER_SIZE; |
1140 | 1140 | ||
1141 | DEBUG_ENT("reading %d bits\n", n*8); | 1141 | DEBUG_ENT("reading %zu bits\n", n*8); |
1142 | 1142 | ||
1143 | n = extract_entropy_user(&blocking_pool, buf, n); | 1143 | n = extract_entropy_user(&blocking_pool, buf, n); |
1144 | 1144 | ||
1145 | DEBUG_ENT("read got %d bits (%d still needed)\n", | 1145 | if (n < 0) { |
1146 | retval = n; | ||
1147 | break; | ||
1148 | } | ||
1149 | |||
1150 | DEBUG_ENT("read got %zd bits (%zd still needed)\n", | ||
1146 | n*8, (nbytes-n)*8); | 1151 | n*8, (nbytes-n)*8); |
1147 | 1152 | ||
1148 | if (n == 0) { | 1153 | if (n == 0) { |
@@ -1167,10 +1172,6 @@ random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | |||
1167 | continue; | 1172 | continue; |
1168 | } | 1173 | } |
1169 | 1174 | ||
1170 | if (n < 0) { | ||
1171 | retval = n; | ||
1172 | break; | ||
1173 | } | ||
1174 | count += n; | 1175 | count += n; |
1175 | buf += n; | 1176 | buf += n; |
1176 | nbytes -= n; | 1177 | nbytes -= n; |