digest: Drop usage of memmap
digest_file_window() first tries to memmap the file before it falls back
to reading it. This is quite unnecessary, we can just always read.

Moreover, memmapping a file has problems with the current code. A
"md5sum foo" result in the filesize argument being MAX_LFS_FILESIZE.
This is fine for files where the file is just read up to the end in
this case, but for memmapped buffers this results in digesting
MAX_LFS_FILESIZE bytes which is wrong. This problem is not apparent
at the moment as there are only a few files which are memmappable,
and on these (/dev/mem, /dev/ram0) digest commands are normally
called with an explicit size argument. This changes once ramfs starts
supporting memmap, so better drop memmapping in the digest code now.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 43902e5 commit 2ceac684bd857826e7530fa704ed6276e87f5c62
@Sascha Hauer Sascha Hauer authored on 11 Jun 2020
Showing 1 changed file
View
crypto/digest.c