]> git.baikalelectronics.ru Git - kernel.git/commit
ima: always return negative code for error
authorSascha Hauer <s.hauer@pengutronix.de>
Tue, 2 Jul 2019 08:00:40 +0000 (10:00 +0200)
committerMimi Zohar <zohar@linux.ibm.com>
Mon, 5 Aug 2019 22:40:27 +0000 (18:40 -0400)
commitc50d20d8293af351b597f4ad56fc08de6e8277da
treee369877467e809e5557e7c2d9446b0612a8b37bb
parentfbf8cec7ee69d4a35671dde3f29780bbce819774
ima: always return negative code for error

integrity_kernel_read() returns the number of bytes read. If this is
a short read then this positive value is returned from
ima_calc_file_hash_atfm(). Currently this is only indirectly called from
ima_calc_file_hash() and this function only tests for the return value
being zero or nonzero and also doesn't forward the return value.
Nevertheless there's no point in returning a positive value as an error,
so translate a short read into -EINVAL.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
security/integrity/ima/ima_crypto.c