From 748fd8f4806f9b49091edf9113b9cd40f1d69387 Mon Sep 17 00:00:00 2001 From: Mimi Zohar Date: Fri, 21 Aug 2009 14:32:49 -0400 Subject: [PATCH] --- yaml --- r: 157011 b: refs/heads/master c: 16bfa38b1936212428cb38fbfbbb8f6c62b8d81f h: refs/heads/master i: 157009: eeb55efb8ee7b7459bf35892debb7bf5714d4a69 157007: 76fd4caddec9aad877cdaae6c8e9d5b238a773d6 v: v3 --- [refs] | 2 +- trunk/security/integrity/ima/ima_crypto.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 6d17257007bc..586bcaddc9b7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6777d773a463ac045d333b989d4e44660f8d92ad +refs/heads/master: 16bfa38b1936212428cb38fbfbbb8f6c62b8d81f diff --git a/trunk/security/integrity/ima/ima_crypto.c b/trunk/security/integrity/ima/ima_crypto.c index 63003a63aaee..46642a19bc78 100644 --- a/trunk/security/integrity/ima/ima_crypto.c +++ b/trunk/security/integrity/ima/ima_crypto.c @@ -45,9 +45,9 @@ int ima_calc_hash(struct file *file, char *digest) { struct hash_desc desc; struct scatterlist sg[1]; - loff_t i_size; + loff_t i_size, offset = 0; char *rbuf; - int rc, offset = 0; + int rc; rc = init_desc(&desc); if (rc != 0) @@ -67,6 +67,8 @@ int ima_calc_hash(struct file *file, char *digest) rc = rbuf_len; break; } + if (rbuf_len == 0) + break; offset += rbuf_len; sg_init_one(sg, rbuf, rbuf_len);