spl: add squashfs support

Implement spl_load_image_sqfs() in spl code.

This will be used in MMC to read a file from a squashfs partition.

Also, loosen squashfs read checks on file size by not failing when a
bigger size than the actual file size is requested. (Just read the file)
This is needed for FIT loading, because the length is ALIGNed.

Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
This commit is contained in:
Richard Genoud
2026-03-13 11:42:26 +01:00
committed by Tom Rini
parent 5e23f7f9f3
commit 6494e823b4
5 changed files with 91 additions and 7 deletions

View File

@@ -1490,13 +1490,11 @@ static int sqfs_read_nest(const char *filename, void *buf, loff_t offset,
goto out;
}
/* If the user specifies a length, check its sanity */
if (len) {
if (len > finfo.size) {
ret = -EINVAL;
goto out;
}
/*
* For FIT loading, the len is ALIGN, so it may exceed the actual size.
* Let's just read the max.
*/
if (len && len < finfo.size) {
finfo.size = len;
} else {
len = finfo.size;