diff options
Diffstat (limited to 'security/integrity/ima')
-rw-r--r-- | security/integrity/ima/ima_crypto.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c index 63003a63aaee..46642a19bc78 100644 --- a/security/integrity/ima/ima_crypto.c +++ b/security/integrity/ima/ima_crypto.c | |||
@@ -45,9 +45,9 @@ int ima_calc_hash(struct file *file, char *digest) | |||
45 | { | 45 | { |
46 | struct hash_desc desc; | 46 | struct hash_desc desc; |
47 | struct scatterlist sg[1]; | 47 | struct scatterlist sg[1]; |
48 | loff_t i_size; | 48 | loff_t i_size, offset = 0; |
49 | char *rbuf; | 49 | char *rbuf; |
50 | int rc, offset = 0; | 50 | int rc; |
51 | 51 | ||
52 | rc = init_desc(&desc); | 52 | rc = init_desc(&desc); |
53 | if (rc != 0) | 53 | if (rc != 0) |
@@ -67,6 +67,8 @@ int ima_calc_hash(struct file *file, char *digest) | |||
67 | rc = rbuf_len; | 67 | rc = rbuf_len; |
68 | break; | 68 | break; |
69 | } | 69 | } |
70 | if (rbuf_len == 0) | ||
71 | break; | ||
70 | offset += rbuf_len; | 72 | offset += rbuf_len; |
71 | sg_init_one(sg, rbuf, rbuf_len); | 73 | sg_init_one(sg, rbuf, rbuf_len); |
72 | 74 | ||