[PATCH V3 1/4] bash-completion:fix shellcheck error

2022-12-06 Thread t.feng via Grub-devel
SC2070 (error): -n doesn't work with unquoted arguments. Quote or use [[ ]]. In grub-completion.bash.in line 130: [ -n $tmp ] && { ^--^ SC2070 (error) More: https://github.com/koalaman/shellcheck/wiki/SC2070 Signed-off-by: "t.feng" --- util/bash-completion.d/grub-

[PATCH V3 3/4] bash-completion:fix shellcheck SC2155-Warning

2022-12-06 Thread t.feng via Grub-devel
SC2155 (warning): Declare and assign separately to avoid masking return values. The exit status of the command is overridden by the exit status of the creation of the local variable. In grub-completion.bash.in line 115: local config_file=$(__grub_dir)/grub.cfg ^-^ SC2155 (w

[PATCH V3 2/4] bash-completion:fix shellcheck SC2207-Warning

2022-12-06 Thread t.feng via Grub-devel
COMPREPLY=($(command)) are doing unquoted command expansion in an array. This will invoke the shell's sloppy word splitting and glob expansion. If we want to split the output into lines or words, use read -r and loops will be better. This prevents the shell from doing unwanted splitting and glob

[PATCH V3 4/4] bash-completion:disable shellcheck SC2120-Warning

2022-12-06 Thread t.feng via Grub-devel
SC2120 (warning): function references arguments, but none are ever passed. In grub-completion.bash.in line 63: __grub_get_options_from_help () { ^-- SC2120 (warning) local prog if [ $# -ge 1 ]; then prog="$1" The arg of __grub_get_options_from_help is optional, so the current

[PATCH V3 0/4] bash-completion:fix shellcheck error and warning

2022-12-06 Thread t.feng via Grub-devel
Hi, The patch set fix some warning and error in grub-completion.bash.in. And shellcheck also provides 'info' and 'style' level check, i think grub do not need to modify. shellcheck -s bash -S warning grub-completion.bash.in shellcheck:https://github.com/koalaman/shellcheck V3: change functions

[PATCH V2 4/4] bash-completion:disable shellcheck SC2120-Warning

2022-11-30 Thread t.feng via Grub-devel
In grub-completion.bash.in line 63: __grub_get_options_from_help () { ^-- SC2120 (warning) SC2120: the current code meets the exception and does not need to be modified. So we disable it. ref:https://github.com/koalaman/shellcheck/wiki/SC2120 Signed-off-by: "t.feng" --- util/bash-completion.d/

[PATCH V2 0/4] bash-completion:fix shellcheck error and warning

2022-11-30 Thread t.feng via Grub-devel
Hi, The patch set fix some warning and error in grub-completion.bash.in. And shellcheck also provides 'info' and 'style' level check, i think grub do not need to modify. shellcheck -s bash -S warning grub-completion.bash.in shellcheck:https://github.com/koalaman/shellcheck V2: split warnings p

[PATCH V2 2/4] bash-completion:fix shellcheck SC2207-Warning

2022-11-30 Thread t.feng via Grub-devel
SC2207 (warning): Prefer mapfile or read -a to split command output (or quote to avoid splitting). In grub-completion.bash.in line 56: COMPREPLY=($(compgen -P "${2-}" -W "${1-}" -S "${4-}" -- "$cur")) ^-- SC2207 (warning) In grub-completion.bash.in line 119: COM

[PATCH V2 3/4] bash-completion:fix shellcheck SC2155-Warning

2022-11-30 Thread t.feng via Grub-devel
In grub-completion.bash.in line 115: local config_file=$(__grub_dir)/grub.cfg ^-^ SC2155 (warning) In grub-completion.bash.in line 126: local grub_dir=$(__grub_dir) ^--^ SC2155 (warning) ref:https://github.com/koalaman/shellcheck/wiki/SC2155 Signed-off-by:

[PATCH V2 1/4] bash-completion:fix shellcheck error

2022-11-30 Thread t.feng via Grub-devel
SC2070 (error): -n doesn't work with unquoted arguments. Quote or use [[ ]]. In grub-completion.bash.in line 130: [ -n $tmp ] && { ^--^ SC2070 (error) ref:https://github.com/koalaman/shellcheck/wiki/SC2070 Signed-off-by: "t.feng" --- util/bash-completion.d/grub-co

[PATCH V2 0/9] fix memory leaks in fs module

2022-11-29 Thread t.feng via Grub-devel
Hi all, I am doing code review in grub-core/fs module and I found some memory leaks. V2: use goto statement in fs/minix and fs/ntfs. ** t.feng (9): fs/affs:Fix memory leaks in grub_affs_create_node fs/btrfs: Fix memory leak in find_path fs/minix: Fix memory leak i

[PATCH V2 6/9] fs/hfsplus: Fix memory leak in grub_hfsplus_btree_search

2022-11-29 Thread t.feng via Grub-devel
Fix memory leak in grub_hfsplus_btree_search. Fixes: 58ea11d5b(Don't fetch a key beyond the end of the node) Signed-off-by: "t.feng" Reviewed-by: Daniel Kiper --- grub-core/fs/hfsplus.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/hfsplus.c b/grub-core/f

[PATCH V2 5/9] fs/bfs: Fix memory leak in read_bfs_file

2022-11-29 Thread t.feng via Grub-devel
Fix memory leaks in read_bfs_file. l1_entries and l2_entries are forgotten to be freed if end of reading file. Fixes: 5825b3794(BFS implementation based on the specification.) Signed-off-by: "t.feng" Reviewed-by: Daniel Kiper --- grub-core/fs/bfs.c | 2 ++ 1 file changed, 2 insertions(+) diff

[PATCH V2 2/9] fs/btrfs: Fix memory leak in find_path

2022-11-29 Thread t.feng via Grub-devel
Fix memory leak in find_path. Fixs: 82591fa6e(Make / in btrfe refer to real root) Signed-off-by: "t.feng" Reviewed-by: Daniel Kiper --- grub-core/fs/btrfs.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index ec72f7be3..19

[PATCH V2 3/9] fs/minix: Fix memory leak in grub_minix_lookup_symlink

2022-11-29 Thread t.feng via Grub-devel
Fix memory leaks in grub_minix_lookup_symlink. Fixes: a07e6ad01(Remove variable length arrays) Signed-off-by: "t.feng" --- grub-core/fs/minix.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c index 953df1191..5354951d1 100644

[PATCH V2 1/9] fs/affs:Fix memory leaks in grub_affs_create_node

2022-11-29 Thread t.feng via Grub-devel
hashtable is unfreed in case GRUB_AFFS_FILETYPE_HARDLINK if grub_disk_read failed. Because, if grub_affs_create_node return not zero, the hashtable should be freed. By the way hashtable is unused in grub_affs_create_node, so we can remove the parameter and take care of it in grub_affs_iterate_dir.

[PATCH V2 7/9] fs/iso9660: Fix memory leak in grub_iso9660_susp_iterate

2022-11-29 Thread t.feng via Grub-devel
Fix memory leak in grub_iso9660_susp_iterate. Fixes: 99373ce47(iso9660.c: Remove nested functions.) Signed-off-by: "t.feng" Reviewed-by: Thomas Schmitt Reviewed-by: Daniel Kiper --- grub-core/fs/iso9660.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/grub-core

[PATCH V2 4/9] fs/ntfs: Fix memory leak in grub_ntfs_read_symlink

2022-11-29 Thread t.feng via Grub-devel
Fix memory leaks in grub_ntfs_read_symlink. Fixes: 5773fb641(Support NTFS reparse points.) Signed-off-by: "t.feng" --- grub-core/fs/ntfs.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c index 3511e4e2c..

[PATCH V2 8/9] fs/squash4: Fix memeory leak in grub_squash_iterate_dir

2022-11-29 Thread t.feng via Grub-devel
Fix memory leaks in grub_squash_iterate_dir. Fixes: 20dd511c8(Handle "." and ".." on squashfs.) Signed-off-by: "t.feng" Reviewed-by: Daniel Kiper --- grub-core/fs/squash4.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/grub-core/fs/squash4.c b/grub-c

[PATCH V2 9/9] fs/xfs: Fix memory leaks in xfs

2022-11-29 Thread t.feng via Grub-devel
Fix memory leaks in xfs. Signed-off-by: "t.feng" Reviewed-by: Daniel Kiper --- grub-core/fs/xfs.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c index d6de7f1a2..b67407690 100644 --- a/grub-core/fs/xfs.c +++ b/grub-core/fs

[PATCH 2/9] fs/btrfs: Fix memory leak in find_path

2022-11-19 Thread t.feng via Grub-devel
Fix memory leak in find_path. Fixs: 82591fa6e(Make / in btrfe refer to real root) Signed-off-by: "t.feng" --- grub-core/fs/btrfs.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index ec72f7be3..19bff4610 100644 --- a/grub-c

[PATCH 6/9] fs/hfsplus: Fix memory leak in grub_hfsplus_btree_search

2022-11-19 Thread t.feng via Grub-devel
Fix memory leak in grub_hfsplus_btree_search. Fixes: 58ea11d5b(Don't fetch a key beyond the end of the node) Signed-off-by: "t.feng" --- grub-core/fs/hfsplus.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c index 6337cbfcb

[PATCH 3/9] fs/minix: Fix memory leak in grub_minix_lookup_symlink

2022-11-19 Thread t.feng via Grub-devel
Fix memory leaks in grub_minix_lookup_symlink. Fixes: a07e6ad01(Remove variable length arrays) Signed-off-by: "t.feng" --- grub-core/fs/minix.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c index 953df1191..2176b6e93

[PATCH 1/9] fs/affs:Fix memory leaks in grub_affs_create_node

2022-11-19 Thread t.feng via Grub-devel
hashtable is unfreed in case GRUB_AFFS_FILETYPE_HARDLINK if grub_disk_read failed. Because, if grub_affs_create_node return not zero, the hashtable should be freed. By the way hashtable is unused in grub_affs_create_node, so we can remove the parameter and take care of it in grub_affs_iterate_dir.

[PATCH 5/9] fs/bfs: Fix memory leak in read_bfs_file

2022-11-19 Thread t.feng via Grub-devel
Fix memory leaks in read_bfs_file. l1_entries and l2_entries are forgotten to be freed if end of reading file. Fixes: 5825b3794(BFS implementation based on the specification.) Signed-off-by: "t.feng" --- grub-core/fs/bfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/grub-core/fs/bfs.c

[PATCH 7/9] fs/iso9660: Fix memory leak in grub_iso9660_susp_iterate

2022-11-19 Thread t.feng via Grub-devel
Fix memory leak in grub_iso9660_susp_iterate. Fixes: 99373ce47(iso9660.c: Remove nested functions.) Signed-off-by: "t.feng" --- grub-core/fs/iso9660.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c index 91817ec1f..

[PATCH 9/9] fs/xfs: Fix memory leaks in xfs

2022-11-19 Thread t.feng via Grub-devel
Fix memory leaks in xfs. Signed-off-by: "t.feng" --- grub-core/fs/xfs.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c index d6de7f1a2..b67407690 100644 --- a/grub-core/fs/xfs.c +++ b/grub-core/fs/xfs.c @@ -585,7 +585,10 @@

[PATCH 0/9] fix memory leaks in fs module

2022-11-19 Thread t.feng via Grub-devel
Hi all, I am doing code review in grub-core/fs module and I found some memory leaks. * t.feng (9): fs/affs:Fix memory leaks in grub_affs_create_node fs/btrfs: Fix memory leak in find_path fs/minix: Fix memory leak in grub_minix_lookup_symlink fs/ntfs: Fix memory le

[PATCH 4/9] fs/ntfs: Fix memory leak in grub_ntfs_read_symlink

2022-11-19 Thread t.feng via Grub-devel
Fix memory leaks in grub_ntfs_read_symlink. Fixes: 5773fb641(Support NTFS reparse points.) Signed-off-by: "t.feng" --- grub-core/fs/ntfs.c | 26 ++ 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c index 3511e4e2c..e

[PATCH 8/9] fs/squash4: Fix memeory leak in grub_squash_iterate_dir

2022-11-19 Thread t.feng via Grub-devel
Fix memory leaks in grub_squash_iterate_dir. Fixes: 20dd511c8(Handle "." and ".." on squashfs.) Signed-off-by: "t.feng" --- grub-core/fs/squash4.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c index 02b1

[PATCH V2] multiboot: fix memory leak

2022-11-09 Thread t.feng via Grub-devel
The commit eb33e61b3 (multiboot: fix memory leak) did not fix all issues. Fix all of them right now. Fixes: eb33e61b3 (multiboot: fix memory leak) Signed-off-by: "t.feng" --- grub-core/loader/multiboot_elfxx.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff

[PATCH] multiboot: fix memory leak

2022-10-28 Thread t.feng via Grub-devel
The commit eb33e61b3 (multiboot: fix memory leak) did not fix all issues. Fix all of them right now. Fixes: eb33e61b3 (multiboot: fix memory leak) --- grub-core/loader/multiboot_elfxx.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/grub-core/loader/

[PATCH] multiboot: fix memory leak

2022-10-15 Thread t.feng via Grub-devel
follow up the commit: eb33e61b31902a5493468895aaf83fa0b4f5f59d it seems that old commit can not fix memory leak completely. --- grub-core/loader/multiboot_elfxx.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core

[PATCH 2/2] bash-completion:fix shellcheck warning

2022-09-18 Thread t.feng via Grub-devel
SC2207 (warning): Prefer mapfile or read -a to split command output (or quote to avoid splitting). SC2120 (warning): __grub_get_options_from_help references arguments, but none are ever passed. SC2155 (warning): Declare and assign separately to avoid masking return values. In grub-completion.bash.

[PATCH 1/2] bash-completion:fix shellcheck error

2022-09-18 Thread t.feng via Grub-devel
SC2070 (error): -n doesn't work with unquoted arguments. Quote or use [[ ]]. In grub-completion.bash.in line 130: [ -n $tmp ] && { ^--^ SC2070 (error) ref:https://github.com/koalaman/shellcheck/wiki/SC2070 --- util/bash-completion.d/grub-completion.bash.in | 2 +-

[PATCH 0/2] bash-completion:fix shellcheck error and warning

2022-09-18 Thread t.feng via Grub-devel
Hi, The patch set fix some warning and error in grub-completion.bash.in. And shellcheck also provides 'info' and 'style' level check, i think grub do not need to modify. shellcheck -s bash -S warning grub-completion.bash.in shellcheck:https://github.com/koalaman/shellcheck t.feng (2): bash-com