Once a pattern file can be much larger, it will be possible that
kernel will return a short read while loading the file and thus may
randomly only load part of the file.
Fix this by putting the read in a loop so the entire file will be
read.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Vincent Fu <vincent.fu@samsung.com>