Re: [PATCH 0/3] test/py: Rewrite SquashFS commands test suite

2021-05-26 Thread Richard Genoud
-by: Richard Genoud Thanks !

Re: [PATCH] fs/squashfs: fix reading of fragmented files

2021-05-20 Thread Richard Genoud
offset. Replace these loops by equivalent calls to memcpy, with the right parameters. I tested this patch by comparing the MD5 checksum of a few fragmented files with the respective md5sum output in sandbox, considering both compressed and uncompressed fragments. Signed-off-by: Joao Marcos Cos

Re: [PATCH v2 27/28] fs/squashfs: sqfs_read: fragmented files are not supported

2021-05-11 Thread Richard Genoud
---8< Subject: [PATCH] test/py: SquashFS: Check if loaded file is corrupted After loading the file in memory, its content should be checked for errors. Signed-off-by: Richard Genoud --- test/py/tests/test_fs/test_squashfs/sqfs_common.py| 5 - test/py/tests/test_fs/test_squash

Re: [PATCH] fs: squasfs: fix a possible NULL pointer dereference in sqfs_opendir()

2020-12-22 Thread Richard Genoud
Hi Miquel Le 22/12/2020 à 08:46, Miquel Raynal a écrit : Hi Richard, Richard Genoud wrote on Mon, 21 Dec 2020 17:17:56 +0100: Hi Miquel Le 21/12/2020 à 16:49, Miquel Raynal a écrit : Hi Richard, Richard Genoud wrote on Mon, 21 Dec 2020 16:40:51 +0100: Hi Miquel, Le 21/12/2020 à 16

Re: [PATCH] fs: squasfs: fix a possible NULL pointer dereference in sqfs_opendir()

2020-12-21 Thread Richard Genoud
Hi Miquel Le 21/12/2020 à 16:49, Miquel Raynal a écrit : Hi Richard, Richard Genoud wrote on Mon, 21 Dec 2020 16:40:51 +0100: Hi Miquel, Le 21/12/2020 à 16:29, Miquel Raynal a écrit : Hi Richard, Richard Genoud wrote on Mon, 21 Dec 2020 16:26:00 +0100: Le 21/12/2020 à 16:14, Miquel

Re: [PATCH] fs: squasfs: fix a possible NULL pointer dereference in sqfs_opendir()

2020-12-21 Thread Richard Genoud
Hi Miquel, Le 21/12/2020 à 16:29, Miquel Raynal a écrit : Hi Richard, Richard Genoud wrote on Mon, 21 Dec 2020 16:26:00 +0100: Le 21/12/2020 à 16:14, Miquel Raynal a écrit : Hi Richard, Richard Genoud wrote on Mon, 21 Dec 2020 16:06:37 +0100: Hi Miquel, Le 18/12/2020 à 19:50

Re: [PATCH] fs: squasfs: fix a possible NULL pointer dereference in sqfs_opendir()

2020-12-21 Thread Richard Genoud
Le 21/12/2020 à 16:14, Miquel Raynal a écrit : Hi Richard, Richard Genoud wrote on Mon, 21 Dec 2020 16:06:37 +0100: Hi Miquel, Le 18/12/2020 à 19:50, Miquel Raynal a écrit : Hi Richard, Richard Genoud wrote on Fri, 18 Dec 2020 15:24:40 +0100: token_count may be != 0 and token_list

Re: [PATCH] fs: squasfs: fix a possible NULL pointer dereference in sqfs_opendir()

2020-12-21 Thread Richard Genoud
Hi Miquel, Le 18/12/2020 à 19:50, Miquel Raynal a écrit : Hi Richard, Richard Genoud wrote on Fri, 18 Dec 2020 15:24:40 +0100: token_count may be != 0 and token_list not yet allocated when the out code is reached Wouldn't it be better to initialize token_count than adding an (ob

[PATCH] fs: squasfs: fix a possible NULL pointer dereference in sqfs_opendir()

2020-12-18 Thread Richard Genoud
token_count may be != 0 and token_list not yet allocated when the out code is reached Reported-by: Coverity CID 313547 Fixes: ea1b1651c6a8 ("fs/squashfs: sqfs_opendir: simplify error handling") Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 5 +++-- 1 file changed, 3 insert

Re: [PATCH v2 27/28] fs/squashfs: sqfs_read: fragmented files are not supported

2020-11-25 Thread Richard Genoud
Hi, Le 20/11/2020 à 02:35, Tom Rini a écrit : On Tue, Nov 03, 2020 at 12:11:25PM +0100, Richard Genoud wrote: The code for reading a fragmented file is not functionnal. It's better to signal this to the user. Signed-off-by: Richard Genoud This change causes the test.py squashfs tes

[PATCH] fs/squashfs: sqfs_close/sqfs_read_sblk: set ctxt.sblk to NULL after free

2020-11-24 Thread Richard Genoud
This will prevent a double free error if sqfs_close() is called twice. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 15208b4dab0..4e6b6058f97 100644 --- a/fs/squashfs

Re: [PATCH v2 22/28] fs/squashfs: sqfs_close/sqfs_read_sblk: set ctxt.sblk to NULL after free

2020-11-20 Thread Richard Genoud
Le 20/11/2020 à 02:35, Tom Rini a écrit : On Tue, Nov 03, 2020 at 12:11:20PM +0100, Richard Genoud wrote: This will prevent a double free error if sqfs_close() is called twice. Signed-off-by: Richard Genoud This change causes the test.py squashfs tests to fail. I am unsure if the problem

Re: [PATCH v2 00/28] fs/squashfs: fix memory leaks and introduce exists() function

2020-11-03 Thread Richard Genoud
Le 03/11/2020 à 12:10, Richard Genoud a écrit : This patch series fix several memory leaks, some use of dangling pointers (leading to cpu freeze) and finally introduce the exists() function for squashfs. This function enable testing the existence of a file, which is mandatory for using the

[PATCH v2 28/28] fs/squashfs: implement exists() function

2020-11-03 Thread Richard Genoud
This permits to find a file and use the distro_bootcmd Signed-off-by: Richard Genoud --- fs/fs.c| 2 +- fs/squashfs/sqfs.c | 38 ++ include/squashfs.h | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/fs/fs.c b/fs/fs.c index

[PATCH v2 27/28] fs/squashfs: sqfs_read: fragmented files are not supported

2020-11-03 Thread Richard Genoud
The code for reading a fragmented file is not functionnal. It's better to signal this to the user. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index f63a06fd40f..a96c1d4f564 100644

[PATCH v2 26/28] fs/squashfs: sqfs_read: remove buggy offset functionality

2020-11-03 Thread Richard Genoud
offset is the offset in the file read, not the offset in the destination buffer. If the offset is not null, this will lead to a memory corruption. So, for now, we are returning an error if the offset is used. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 16 1 file

[PATCH v2 25/28] fs/squashfs: sqfs_read: don't write beyond buffer size

2020-11-03 Thread Richard Genoud
The length of the buffer wasn't taken into account when writing to the given buffer. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 8 1 file changed, 8 insertions(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index fa3120aefd6..4710b2bd707 100644 --- a/fs/squ

[PATCH v2 20/28] fs/squashfs: sqfs_read: fix memory leak on finfo.blk_sizes

2020-11-03 Thread Richard Genoud
finfo.blk_sizes may not be freed in case of error in the for loop Setting it to null and freeing it at the end makes prevents that from happening. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 48 +- 1 file changed, 22 insertions(+), 26

[PATCH v2 22/28] fs/squashfs: sqfs_close/sqfs_read_sblk: set ctxt.sblk to NULL after free

2020-11-03 Thread Richard Genoud
This will prevent a double free error if sqfs_close() is called twice. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 7d6f0e88e31..a46e19c75c5 100644 --- a/fs/squashfs/sqfs.c +++ b/fs

[PATCH v2 23/28] fs/squashfs: sqfs_probe: reset cur_dev/cur_part_info to NULL on error

2020-11-03 Thread Richard Genoud
Resetting the context on error will prevent some checks like: if (!ctx.cur_dev) To pass when the probe method has failed Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index

[PATCH v2 24/28] fs/squashfs: sqfs_probe: use sqfs_decompressor_init() return value

2020-11-03 Thread Richard Genoud
sqfs_decompressor_init() returns a value, so it's better to use it than to force the return value to EINVAL (it could be ENOMEM) Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 9682ea

[PATCH v2 17/28] fs/squashfs: sqfs_frag_lookup: simplify error handling

2020-11-03 Thread Richard Genoud
For consistency with other functions. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 28 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index cfea313e34b..b97a961c5e3 100644 --- a/fs/squashfs/sqfs.c

[PATCH v2 21/28] fs/squashfs: sqfs_probe: fix possible memory leak on error

2020-11-03 Thread Richard Genoud
If SquashFS magic number is invalid, there's a memory leak. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index d8d4584fbfd..7d6f0e88e31 100644 --- a/fs/squ

[PATCH v2 19/28] fs/squashfs: sqfs_get_abs_path: fix possible memory leak on error

2020-11-03 Thread Richard Genoud
if sqfs_tokenize(rel_tokens, rc, rel); fails, the function exits without freeing the array base_tokens. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs

[PATCH v2 18/28] fs/squashfs: sqfs_get_abs_path: fix error check

2020-11-03 Thread Richard Genoud
the return value of sqfs_tokenize(rel_tokens, rc, rel); wasn't checked. (but "ret" value was !) This is obviouly a typo. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/squashfs/sqfs.c b/fs/squash

[PATCH v2 16/28] fs/squashfs: sqfs_read: fix another memory leak

2020-11-03 Thread Richard Genoud
data_buffer was allocated in a loop and freed only once. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index a9e803cbac2..cfea313e34b 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c

[PATCH v2 14/28] fs/squashfs: sqfs_read: remove useless sqfs_closedir()

2020-11-03 Thread Richard Genoud
as sqfs_opendir failed, there's no need to call sqfs_closedir Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 13e64bea934..1ac07625889 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/s

[PATCH v2 09/28] fs/squashfs: sqfs_read_inode_table: fix dangling pointer

2020-11-03 Thread Richard Genoud
inode_table should not be left dangling as it may be freed in sqfs_opendir Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 1714306e747..72181f38332 100644 --- a/fs/squashfs/sqfs.c +++ b/fs

[PATCH v2 15/28] fs/squashfs: sqfs_read: fix memory leak

2020-11-03 Thread Richard Genoud
sqfs_closedir() should be called to free memory allocated by sqfs_opendir() Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 1ac07625889..a9e803cbac2 100644 --- a/fs/squashfs

[PATCH v2 12/28] fs/squashfs: sqfs_size: remove useless sqfs_closedir()

2020-11-03 Thread Richard Genoud
as sqfs_opendir failed, there's no need to call sqfs_closedir Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 3b008b5235c..f4cac3e4bf0 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/s

[PATCH v2 13/28] fs/squashfs: sqfs_read: fix dangling pointer dirs->entry

2020-11-03 Thread Richard Genoud
dirs->entry shouldn't be left dangling as it could be freed twice. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index f4cac3e4bf0..13e64bea934 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/

[PATCH v2 10/28] fs/squashfs: sqfs_concat_tokens: check if malloc succeeds

2020-11-03 Thread Richard Genoud
memory allocation should always be checked Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 72181f38332..7da2e09cc36 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -242,6 +242,9

[PATCH v2 07/28] fs/squashfs: sqfs_search_dir: fix dangling pointer

2020-11-03 Thread Richard Genoud
dirs->entry shouldn't be left dangling as it could be freed twice. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 5 + 1 file changed, 5 insertions(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 9d460e8bed6..78893b5c85d 100644 --- a/fs/squashfs/sqfs.c

[PATCH v2 08/28] fs/squashfs: sqfs_search_dir: fix memory leaks

2020-11-03 Thread Richard Genoud
path, target, res, rem and sym_tokens were not free on error nor success. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 64 -- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index

[PATCH v2 11/28] fs/squashfs: sqfs_size: fix dangling pointer dirs->entry

2020-11-03 Thread Richard Genoud
dirs->entry shouldn't be left dangling as it could be freed twice. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 7da2e09cc36..3b008b5235c 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/

[PATCH v2 05/28] fs/squashfs: sqfs_split_path: fix memory leak and dangling pointers

2020-11-03 Thread Richard Genoud
*file and *dir were not freed on error Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 40 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 0ac922af9e7..58b8bfc66dc 100644 --- a/fs

[PATCH v2 03/28] fs/squashfs: sqfs_opendir: simplify error handling

2020-11-03 Thread Richard Genoud
Using only one label permits to prevents bugs when moving code around. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 27 --- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 1fdb9ac534b..b94a9715205

[PATCH v2 02/28] fs/squashfs: sqfs_opendir: fix some memory leaks and dangling pointers

2020-11-03 Thread Richard Genoud
When trying to load an non-existing file, the cpu hangs! Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 37 + 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 15208b4dab0..1fdb9ac534b 100644

[PATCH v2 06/28] fs/squashfs: sqfs_read_directory_table: fix memory leak

2020-11-03 Thread Richard Genoud
pos_list wasn't freed on every error Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 31 +-- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 58b8bfc66dc..9d460e8bed6 100644 --- a/fs/squashfs/s

[PATCH v2 04/28] fs/squashfs: sqfs_closedir: fix memory leak

2020-11-03 Thread Richard Genoud
sqfs_dirs wasn't freed anywhere. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index b94a9715205..0ac922af9e7 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -1573,4 +1573,5 @@

[PATCH v2 01/28] fs/squashfs: fix board hang-up when calling .exists()

2020-11-03 Thread Richard Genoud
add missing squashfs function to prevent dangling or null pointers. For exemple, when calling test [ -e somefile ], squashfs.exists may be called. Signed-off-by: Richard Genoud --- fs/fs.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/fs/fs.c b/fs/fs.c index 29ad4d1a695

[PATCH v2 00/28] fs/squashfs: fix memory leaks and introduce exists() function

2020-11-03 Thread Richard Genoud
to prevent writing beyond buffer - prevent reading with an offset since it doesn't work - prevent reading fragmented files since it doesn't work Richard Genoud (28): fs/squashfs: fix board hang-up when calling .exists() fs/squashfs: sqfs_opendir: fix some memory leaks and dangling p

Re: [PATCH 15/17] fs/squashfs: sqfs_read: fix memory leak

2020-10-16 Thread Richard Genoud
Le 14/10/2020 à 10:06, Richard Genoud a écrit : sqfs_closedir() should be called to free memory allocated by sqfs_opendir() Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 79d68dddb28

Re: [PATCH 06/17] fs/squashfs: sqfs_read_directory_table: fix memory leak

2020-10-16 Thread Richard Genoud
Le 15/10/2020 à 18:38, Miquel Raynal a écrit : Hi Richard, That's why I prefer only one label and setting NULL. If I didn't convince you, I'll change it back to multiple labels :) You are right it involves less changes when editing the code. But on the other hand it is so often written like

Re: [PATCH 06/17] fs/squashfs: sqfs_read_directory_table: fix memory leak

2020-10-15 Thread Richard Genoud
Hi Miquel ! Thanks for your feedback. Le 15/10/2020 à 15:54, Miquel Raynal a écrit : Hi Richard, Richard Genoud wrote on Wed, 14 Oct 2020 10:06:11 +0200: pos_list wasn't freed on every error Signed-off-by: Richard Genoud Same comment here (and probably after as well) as in patch

[PATCH 17/17] fs/squashfs: implement exists() function

2020-10-14 Thread Richard Genoud
This permits to find a file and use the distro_bootcmd Signed-off-by: Richard Genoud --- fs/fs.c| 2 +- fs/squashfs/sqfs.c | 38 ++ include/squashfs.h | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/fs/fs.c b/fs/fs.c index

[PATCH 16/17] fs/squashfs: sqfs_read: fix another memory leak

2020-10-14 Thread Richard Genoud
data_buffer was allocated in a loop and freed only once. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 6cd3ba9ce10..82bf1faf25f 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c

[PATCH 13/17] fs/squashfs: sqfs_read: fix dangling pointer dirs->entry

2020-10-14 Thread Richard Genoud
dirs->entry shouldn't be left dangling as it could be freed twice. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 116b5160ee3..0510ae311d1 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/

[PATCH 15/17] fs/squashfs: sqfs_read: fix memory leak

2020-10-14 Thread Richard Genoud
sqfs_closedir() should be called to free memory allocated by sqfs_opendir() Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 79d68dddb28..6cd3ba9ce10 100644 --- a/fs/squashfs/sqfs.c +++ b/fs

[PATCH 12/17] fs/squashfs: sqfs_size: remove useless sqfs_closedir()

2020-10-14 Thread Richard Genoud
as sqfs_opendir failed, there's no need to call sqfs_closedir Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index c5a24450e6f..116b5160ee3 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/s

[PATCH 11/17] fs/squashfs: sqfs_size: fix dangling pointer dirs->entry

2020-10-14 Thread Richard Genoud
dirs->entry shouldn't be left dangling as it could be freed twice. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 24a7680aa5c..c5a24450e6f 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/

[PATCH 14/17] fs/squashfs: sqfs_read: remove useless sqfs_closedir()

2020-10-14 Thread Richard Genoud
as sqfs_opendir failed, there's no need to call sqfs_closedir Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 0510ae311d1..79d68dddb28 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/s

[PATCH 08/17] fs/squashfs: sqfs_search_dir: fix memory leaks

2020-10-14 Thread Richard Genoud
path, target, res, rem and sym_tokens were not free on error nor success. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 64 -- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index

[PATCH 10/17] fs/squashfs: sqfs_concat_tokens: check if malloc succeeds

2020-10-14 Thread Richard Genoud
memory allocation should always be checked Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index c4b7c84e9aa..24a7680aa5c 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -242,6 +242,9

[PATCH 06/17] fs/squashfs: sqfs_read_directory_table: fix memory leak

2020-10-14 Thread Richard Genoud
pos_list wasn't freed on every error Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 31 +-- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 55d183663a8..c4d74fd4d6d 100644 --- a/fs/squashfs/s

[PATCH 07/17] fs/squashfs: sqfs_search_dir: fix dangling pointer

2020-10-14 Thread Richard Genoud
dirs->entry shouldn't be left dangling as it could be freed twice. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 5 + 1 file changed, 5 insertions(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index c4d74fd4d6d..1df27f7b903 100644 --- a/fs/squashfs/sqfs.c

[PATCH 09/17] fs/squashfs: sqfs_read_inode_table: fix dangling pointer

2020-10-14 Thread Richard Genoud
inode_table should not be left dangling as it may be freed in sqfs_opendir Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index eb8851a7148..c4b7c84e9aa 100644 --- a/fs/squashfs/sqfs.c +++ b/fs

[PATCH 05/17] fs/squashfs: sqfs_split_path: fix memory leak and dangling pointers

2020-10-14 Thread Richard Genoud
*file and *dir were not freed on error Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 39 +++ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 0ac922af9e7..55d183663a8 100644 --- a/fs

[PATCH 00/17] fs/squashfs: fix memory leaks and introduce exists() function

2020-10-14 Thread Richard Genoud
patches to be easier to review Richard Genoud (17): fs/squashfs: fix board hang-up when calling .exists() fs/squashfs: sqfs_opendir: fix some memory leaks and dangling pointers fs/squashfs: sqfs_opendir: simplify error handling fs/squashfs: sqfs_closedir: fix memory leak fs/squashfs

[PATCH 02/17] fs/squashfs: sqfs_opendir: fix some memory leaks and dangling pointers

2020-10-14 Thread Richard Genoud
When trying to load an non-existing file, the cpu hangs! Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 37 + 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 15208b4dab0..1fdb9ac534b 100644

[PATCH 04/17] fs/squashfs: sqfs_closedir: fix memory leak

2020-10-14 Thread Richard Genoud
sqfs_dirs wasn't freed anywhere. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index b94a9715205..0ac922af9e7 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -1573,4 +1573,5 @@

[PATCH 03/17] fs/squashfs: sqfs_opendir: simplify error handling

2020-10-14 Thread Richard Genoud
Using only one label permits to prevents bugs when moving code around. Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 27 --- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 1fdb9ac534b..b94a9715205

[PATCH 01/17] fs/squashfs: fix board hang-up when calling .exists()

2020-10-14 Thread Richard Genoud
add missing squashfs function to prevent dangling or null pointers. For exemple, when calling test [ -e somefile ], squashfs.exists may be called. Signed-off-by: Richard Genoud --- fs/fs.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/fs/fs.c b/fs/fs.c index 29ad4d1a695

Re: [PATCH] SPL: stm32mp1: fix spl_mmc_boot_partition not defined

2020-10-13 Thread Richard Genoud
Hi Patrick, Le 13/10/2020 à 14:18, Patrick DELAUNAY a écrit : Hi Richard, From: Richard Genoud Sent: lundi 12 octobre 2020 16:11 spl_mmc_boot_partition is only defined when CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is defined. Signed-off-by: Richard Genoud --- arch/arm/mach-stm32mp

[PATCH] SPL: stm32mp1: fix spl_mmc_boot_partition not defined

2020-10-12 Thread Richard Genoud
spl_mmc_boot_partition is only defined when CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is defined. Signed-off-by: Richard Genoud --- arch/arm/mach-stm32mp/spl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c index e84bdad7bfc

Re: [U-Boot] BUG: fastmap and u-boot's ubi write command

2013-09-25 Thread Richard Genoud
2013/9/25 Richard Weinberger : > Am 25.09.2013 14:13, schrieb Richard Genoud: >>> Before we waste time, please ensure that you have all recent UBI fixes >>> applied. >>> UBI: Fix PEB leak in wear_leveling_worker() (Merged into 3.12-rc1, on it's >>> way

Re: [U-Boot] BUG: fastmap and u-boot's ubi write command

2013-09-25 Thread Richard Genoud
On 25/09/2013 13:10, Richard Weinberger wrote: > Hi! > > Am 25.09.2013 12:59, schrieb Richard Genoud: >> >> [CC u-boot ML since it may not be a kernel only related bug(s)] >> >> Hi Richard, Artem, >> >> I'm still playing with fastmap and I ran int

[U-Boot] BUG: fastmap and u-boot's ubi write command

2013-09-25 Thread Richard Genoud
[CC u-boot ML since it may not be a kernel only related bug(s)] Hi Richard, Artem, I'm still playing with fastmap and I ran into something. It's involving u-boot's "ubi write" command and fastmap. What I'm doing is: - Flashing a mtd partition with a userspace.ubi image via u-boot - Booting linux

Re: [U-Boot] [PATCH 1/2] FAT: remove ifdefs to make the code more readable

2012-12-13 Thread Richard Genoud
2012/12/13 Marek Vasut : > Dear Tom Rini, > > [...] > >> Note that we don't use --gc-sections on all archs so I'm not sure we >> discard the unused VFAT functions on say ARM. > > Valid point, Albert? > > Best regards, > Marek Vasut I check and the code is discarded (on ARM at91sam9x5ek). This is t

[U-Boot] [PATCHv2] FAT: remove ifdefs to make the code more readable

2012-12-13 Thread Richard Genoud
_VFAT is not defined. Signed-off-by: Richard Genoud --- fs/fat/fat.c | 55 +++ fs/fat/fat_write.c | 11 ++--- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 393c378..7c23b67 100644 ---

Re: [U-Boot] [PATCH 1/2] FAT: remove ifdefs to make the code more readable

2012-12-13 Thread Richard Genoud
2012/12/13 Marek Vasut : > Dear Richard Genoud, > >> 2012/12/13 Marek Vasut : >> > Dear Richard Genoud, >> > >> >> ifdefs in the code are making it harder to read. >> >> The use of simple if(VFAT_ENABLED) makes no more code and is cleaner. &

Re: [U-Boot] [PATCH 1/2] FAT: remove ifdefs to make the code more readable

2012-12-13 Thread Richard Genoud
2012/12/13 Tom Rini : > Note that we don't use --gc-sections on all archs so I'm not sure we > discard the unused VFAT functions on say ARM. > I tested it on at91sam9x5ek, and the vfat functions are not present in the System.map. The problem is in my commit message: the linker doesn"t have anythin

Re: [U-Boot] [PATCH 1/2] FAT: remove ifdefs to make the code more readable

2012-12-13 Thread Richard Genoud
2012/12/13 Marek Vasut : > Dear Richard Genoud, > >> ifdefs in the code are making it harder to read. >> The use of simple if(VFAT_ENABLED) makes no more code and is cleaner. >> (the code is discarded by the compiler and linker instead of the >> preprocessor.)

Re: [U-Boot] [PATCH 0/2] clean some FAT code

2012-12-13 Thread Richard Genoud
2012/12/13 Marek Vasut : > Dear Richard Genoud, > > I feel bad for the code when you say it's FAT so explicitly ... it certainly > wishes it was SLIM, but it can't ;-) > :) I didn't write that on purpose... But it's definitely a good war cry ! ___

[U-Boot] [PATCH 2/2] FAT: use toupper/tolower instead of recoding them

2012-12-13 Thread Richard Genoud
toupper/tolower function are already declared, so use them. Signed-off-by: Richard Genoud --- fs/fat/fat.c |3 ++- fs/fat/fat_write.c |3 ++- include/fat.h |3 --- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index c79e3e3

[U-Boot] [PATCH 1/2] FAT: remove ifdefs to make the code more readable

2012-12-13 Thread Richard Genoud
: Richard Genoud --- fs/fat/fat.c | 55 +++ fs/fat/fat_write.c | 11 ++--- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 393c378..c79e3e3 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c

[U-Boot] [PATCH 0/2] clean some FAT code

2012-12-13 Thread Richard Genoud
Hi, Instead of adding some more ugly #ifdefs, I came with another approach. It makes the code easier to read, and correct the compilation error when VFAT wasn't enabled. Best regards, Richard Genoud (2): FAT: remove ifdefs to make the code more readable FAT: use toupper/tolower inste

Re: [U-Boot] [PATCH] FAT: make FAT compile without VFAT

2012-12-04 Thread Richard Genoud
2012/12/4 Marek Vasut : > Dear Richard Genoud, > > Please provide a reasonable commit message. Why is this needed? hi, You're right, my commit message is nearly inexistent.. sorry. This is needed in the case where we don't want the VFAT support (for whatever reason). in t

[U-Boot] [PATCH] FAT: make FAT compile without VFAT

2012-12-04 Thread Richard Genoud
Signed-off-by: Richard Genoud --- fs/fat/fat.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 393c378..defdd74 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -589,7 +589,9 @@ static dir_entry *get_dentfromdir(fsdata *mydata, int

[U-Boot] [PATCHv2] cmd_time: merge run_command_and_time_it with cmd_process

2012-12-03 Thread Richard Genoud
As far as every arch has a get_timer function, run_command_and_time_it code can now disappear. Signed-off-by: Richard Genoud --- common/cmd_time.c | 33 ++--- common/command.c |6 +- common/hush.c |2 +- common/main.c |2 +- include

Re: [U-Boot] [PATCH] cmd_time: merge run_command_and_time_it with cmd_process

2012-12-03 Thread Richard Genoud
2012/12/3 Stefan Roese : >> @@ -543,7 +543,9 @@ enum command_ret_t cmd_process(int flag, int argc, char >> * const argv[], >> >> /* If OK so far, then do the command */ >> if (!rc) { >> + if (ticks) *ticks = get_timer(0); > > Newline please: > > if (ticks) >

[U-Boot] [PATCH] cmd_time: merge run_command_and_time_it with cmd_process

2012-12-03 Thread Richard Genoud
As far as every arch has a get_timer function, run_command_and_time_it code can now disappear. Signed-off-by: Richard Genoud --- common/cmd_time.c | 33 ++--- common/command.c |4 +++- common/hush.c |2 +- common/main.c |2 +- include/command.h

[U-Boot] [PATCHv3 1/4] usb documentation: fix typo

2012-11-30 Thread richard . genoud
From: Richard Genoud Signed-off-by: Richard Genoud --- doc/README.usb |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/doc/README.usb b/doc/README.usb index ef1d6ba..b4c3ef5 100644 --- a/doc/README.usb +++ b/doc/README.usb @@ -63,7 +63,7 @@ Common USB Commands

[U-Boot] [PATCHv3 4/4] at91sam9x5ek: add USB configuration

2012-11-30 Thread richard . genoud
From: Richard Genoud Signed-off-by: Richard Genoud --- include/configs/at91sam9x5ek.h | 23 +++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h index 5e5f9c1..915714f 100644 --- a/include

[U-Boot] [PATCHv3 2/4] at91sam9x5: enable USB support for 9x5ek board.

2012-11-30 Thread richard . genoud
From: Richard Genoud Signed-off-by: Richard Genoud --- arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 13 + arch/arm/include/asm/arch-at91/at91sam9x5.h |2 ++ board/atmel/at91sam9x5ek/at91sam9x5ek.c |3 +++ drivers/usb/host/ohci-at91.c

[U-Boot] [PATCHv3 3/4] at91sam9x5ek: regroup FAT/DOS features

2012-11-30 Thread richard . genoud
From: Richard Genoud Signed-off-by: Richard Genoud --- include/configs/at91sam9x5ek.h |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h index 71f765b..5e5f9c1 100644 --- a/include/configs/at91sam9x5ek.h

[U-Boot] [PATCHv3 0/4] enable USB on sam9x5ek boards

2012-11-30 Thread richard . genoud
From: Richard Genoud This small patchset is based on current master ( 178d0cc1a4c73c3341afbeb2a93b172de8c96bd1 ) It enables usb on at91sam9x5ek boards. Tested on at91sam9x5ek with a sam9g35 CPU (+ usb key and mouse) By default the 3 USB 1.1 ports (A, B and C) are enabled. If CONFIG_USB_EHCI is

Re: [U-Boot] [PATCHv2 2/4] at91sam9x5: enable USB support for 9x5ek board.

2012-11-30 Thread Richard Genoud
2012/11/29 Bo Shen : Hi ! > As port C doesn't support EHCI, so, I think we should deal with this > carefully. > ---<8--- > #if OHCI > #else EHCI > #endif > --->8--- > I think this will be better. yes, you're right, I'll change that ___ U-Boot mailing lis

[U-Boot] [PATCHv2 4/4] at91sam9x5ek: add USB configuration

2012-11-28 Thread Richard Genoud
Signed-off-by: Richard Genoud --- include/configs/at91sam9x5ek.h | 24 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h index 5e5f9c1..fd2586d 100644 --- a/include/configs/at91sam9x5ek.h

[U-Boot] [PATCHv2 3/4] at91sam9x5ek: regroup FAT/DOS features

2012-11-28 Thread Richard Genoud
Signed-off-by: Richard Genoud --- include/configs/at91sam9x5ek.h |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h index 71f765b..5e5f9c1 100644 --- a/include/configs/at91sam9x5ek.h +++ b/include/configs

[U-Boot] [PATCHv2 2/4] at91sam9x5: enable USB support for 9x5ek board.

2012-11-28 Thread Richard Genoud
Signed-off-by: Richard Genoud --- arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 10 ++ arch/arm/include/asm/arch-at91/at91sam9x5.h |2 ++ board/atmel/at91sam9x5ek/at91sam9x5ek.c |3 +++ drivers/usb/host/ohci-at91.c |6 -- 4 files

[U-Boot] [PATCHv2 1/4] usb documentation: fix typo

2012-11-28 Thread Richard Genoud
Signed-off-by: Richard Genoud --- doc/README.usb |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/doc/README.usb b/doc/README.usb index ef1d6ba..b4c3ef5 100644 --- a/doc/README.usb +++ b/doc/README.usb @@ -63,7 +63,7 @@ Common USB Commands: Storage USB Commands: - usb

[U-Boot] [PATCHv2 0/4]enable USB OHCI on sam9x5ek boards

2012-11-28 Thread Richard Genoud
ports (A and B) will be enabled. changes from v1: * VBUS for usb port A is enabled * EHCI configuration is now present * number of OHCI ports corrected (3 instead of 2) Richard Genoud (4): usb documentation: fix typo ARM: at91sam9x5: enable USB OHCI support for 9x5ek board. at91sam9x5ek

Re: [U-Boot] [PATCH 0/4] enable USB OHCI on sam9x5ek boards

2012-11-28 Thread Richard Genoud
2012/11/28 Bo Shen : > Thanks for your work. > I think if enable EHCI instead of OHCI will be better? Yes, I tried it, and it's working great. I'll resend the serie with EHCI enable. Richard. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.den

[U-Boot] [PATCH 2/4] ARM: at91sam9x5: enable USB OHCI support for 9x5ek board.

2012-11-27 Thread Richard Genoud
Signed-off-by: Richard Genoud --- arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |9 + arch/arm/include/asm/arch-at91/at91sam9x5.h |2 ++ board/atmel/at91sam9x5ek/at91sam9x5ek.c |3 +++ drivers/usb/host/ohci-at91.c |6 -- 4 files

[U-Boot] [PATCH 4/4] at91sam9x5ek: add USB OHCI configuration

2012-11-27 Thread Richard Genoud
Signed-off-by: Richard Genoud --- include/configs/at91sam9x5ek.h | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h index 5e5f9c1..444d83e 100644 --- a/include/configs/at91sam9x5ek.h +++ b/include

[U-Boot] [PATCH 3/4] at91sam9x5ek: regroup FAT/DOS features

2012-11-27 Thread Richard Genoud
Signed-off-by: Richard Genoud --- include/configs/at91sam9x5ek.h |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h index 71f765b..5e5f9c1 100644 --- a/include/configs/at91sam9x5ek.h +++ b/include/configs

[U-Boot] [PATCH 1/4] usb documentation: fix typo

2012-11-27 Thread Richard Genoud
Signed-off-by: Richard Genoud --- doc/README.usb |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/doc/README.usb b/doc/README.usb index ef1d6ba..b4c3ef5 100644 --- a/doc/README.usb +++ b/doc/README.usb @@ -63,7 +63,7 @@ Common USB Commands: Storage USB Commands: - usb

[U-Boot] [PATCH 0/4] enable USB OHCI on sam9x5ek boards

2012-11-27 Thread Richard Genoud
This small patchset is based on current master ( 178d0cc1a4c73c3341afbeb2a93b172de8c96bd1 ) It enables usb ohci on at91sam9x5ek boards. Tested it with a sam9g35 CPU and a usb key. Richard Genoud (4): usb documentation: fix typo ARM: at91sam9x5: enable USB OHCI support for 9x5ek board