[PATCH v6 11/14] error: Use format code PRIuGRUB_UINT64_T for 64-bit typed fileblock in grub_error

2021-03-04 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/fs/hfsplus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c index 361e5be49..2a69055c7 100644 --- a/grub-core/fs/hfsplus.c +++ b/grub-core/fs/hfsplus.c @@ -199,7 +199,8 @@ grub_hfspl

[PATCH v6 13/14] error: Do compile-time format string checking on grub_error

2021-03-04 Thread Glenn Washburn
This should help prevent format string errors and thus improve the quality of error reporting. Signed-off-by: Glenn Washburn --- include/grub/err.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/grub/err.h b/include/grub/err.h index 24ba9f5f5..b08d5d0de 100644 ---

[PATCH v6 14/14] zfs: Use grub_uint64_t instead of 1ULL in BF64_*CODE macros

2021-03-04 Thread Glenn Washburn
The underlying type of grub_uint64_t changes across architectures, but 1ULL does not. This allows using these macros as arguments to format string functions that use the PRI* format string macros that also vary with architecture. Change the grub_error call, where this was previously an issue and t

[PATCH v6 10/14] error: Use format code PRIxGRUB_UINT64_T for 64-bit arg in grub_error

2021-03-04 Thread Glenn Washburn
The macro ELF_R_TYPE does not change the underlying type. Here its argument is a 64-bit Elf64_Xword. Make sure the format code matches. For the riscv architecture, rel->r_info could be either Elf32_Xword or Elf64_Xword depending on if 32 or 64-bit risc is being built. So cast to 64-bit value regar

[PATCH v6 08/14] error: Use PRI* macros to get correct format string code across architectures

2021-03-04 Thread Glenn Washburn
Also remove casting of format string args so that the architecture dependent type is preserved. Signed-off-by: Glenn Washburn --- grub-core/loader/i386/pc/linux.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/p

[PATCH v6 05/14] grub_error: Use format code PRIuGRUB_SIZE for variables of type grub_size_t

2021-03-04 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c| 12 grub-core/kern/efi/efi.c | 2 +- grub-core/loader/efi/chainloader.c | 2 +- grub-core/loader/i386/bsd.c| 3 ++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/grub-core/di

[PATCH v6 12/14] error: Use format code llu for 64-bit uint bp->blk_prop in grub_error

2021-03-04 Thread Glenn Washburn
This is a temporary, less-intrusive change to get the build to success with compiler format string checking turned on. There is a better fix which addresses this issue, but it needs more testing. Use this change so that format string checking on grub_error can be turned on until the better change i

[PATCH v6 06/14] pgp: Format code for grub_error is incorrect

2021-03-04 Thread Glenn Washburn
The format code is for a 32-bit int, but the argument, keyid, is declared as a 64 bit int. The comment above says keyid is 32-bit. I'm not sure if the comment or declaration is wrong, so force the display of a 64-bit int for now. Signed-off-by: Glenn Washburn --- grub-core/commands/pgp.c | 4 ++-

[PATCH v6 01/14] misc: Format string for grub_error should be a literal

2021-03-04 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/loader/efi/chainloader.c | 2 +- grub-core/net/tftp.c | 2 +- grub-core/script/lexer.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.

[PATCH v6 09/14] error: Use format code PRIxGRUB_UINT64_T for 64-bit uint argument in grub_error

2021-03-04 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/disk/ata.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/grub-core/disk/ata.c b/grub-core/disk/ata.c index 685f33a19..3620a282e 100644 --- a/grub-core/disk/ata.c +++ b/grub-core/disk/ata.c @@ -219,8 +219,9 @@ grub_ata_se

[PATCH v6 04/14] dmraid_nvidia: Format string error in grub_error

2021-03-04 Thread Glenn Washburn
The grub_error has a format string expecting two arguments, but only one provided. According to the comments in the struct grub_nv_super definition, the version field looks like a version number where major.minor is encoded as each a byte in the two-byte short. Signed-off-by: Glenn Washburn ---

[PATCH v6 03/14] error: grub_error format string add missing format code

2021-03-04 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/video/bochs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/video/bochs.c b/grub-core/video/bochs.c index 7a249eb21..30ea1bd82 100644 --- a/grub-core/video/bochs.c +++ b/grub-core/video/bochs.c @@ -249,11 +249,11 @@ g

[PATCH v6 07/14] efi: Format string error in grub_error

2021-03-04 Thread Glenn Washburn
The second format string argument, GRUB_EFI_MAX_USABLE_ADDRESS, is a macro to a number literal. However depending on what the target architecture, the type can be 32 or 64 bits. Cast to a 64-bit integer. Also, change the format string literals %llx to use PRIxGRUB_UINT64_T. Signed-off-by: Glenn W

[PATCH v6 02/14] error: grub_error missing format string argument

2021-03-04 Thread Glenn Washburn
Its obvious from the error message that the variable named "type" was accidentally omitted. Signed-off-by: Glenn Washburn --- grub-core/parttool/msdospart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/parttool/msdospart.c b/grub-core/parttool/msdospart.c ind

[PATCH v6 00/14] error: Do compile-time format string checking on grub>

2021-03-04 Thread Glenn Washburn
Daniel, you mentioned wanting a separate patch series which is the real fix for patch #12. I've added it to this patch series, since they go together. I can send the single patch as a separate thread if that still desirable. Changes since v5 * Fix formatting issues with spaces around format strin

Re: [PATCH] style: Format string macro should have a space between quotes

2021-03-04 Thread Glenn Washburn
On Thu, 4 Mar 2021 20:03:34 +0100 Daniel Kiper wrote: > Does this patch fix all such issues in the GRUB source code? > > Daniel I don't know and its unclear the scope of your question. However, this is the grep I used to find these instances: grep -rnE '\"PRI|PRI[a-zA-Z_0-9]+\"' Glenn > O

Re: [PATCH v5 12/13] error: Use format code llu for 64-bit uint bp->blk_prop in grub_error

2021-03-04 Thread Glenn Washburn
On Thu, 4 Mar 2021 18:59:53 +0100 Daniel Kiper wrote: > On Wed, Mar 03, 2021 at 07:29:17PM -0600, Glenn Washburn wrote: > > For some reason PRIuGRUB_UINT64_T is not expanding to llu, but to > > lu, which causes the format string check to fail. Use literal and > > force cast until this is debugged

Re: [PATCH] style: Format string macro should have a space between quotes

2021-03-04 Thread Daniel Kiper
Does this patch fix all such issues in the GRUB source code? Daniel On Wed, Mar 03, 2021 at 07:51:04PM -0600, Glenn Washburn wrote: > Signed-off-by: Glenn Washburn > --- > grub-core/disk/luks2.c | 38 +++--- > grub-core/fs/xfs.c | 4 ++-- > 2 files changed,

[PATCH v2] commands/search: Add support to search by PARTUUID

2021-03-04 Thread Vitaly Kuzmichev via Grub-devel
Improve 'search' grub-shell command with functionality to search for a partition by PARTUUID string. This is useful on systems where FSUUID is not guaranteed to be constant, e.g. it is not preserved between system updates, and modifying grub.cfg is undesired. V2: This patch is based on Michael Grz

Re: [PATCH v5 12/13] error: Use format code llu for 64-bit uint bp->blk_prop in grub_error

2021-03-04 Thread Daniel Kiper
On Wed, Mar 03, 2021 at 07:29:17PM -0600, Glenn Washburn wrote: > For some reason PRIuGRUB_UINT64_T is not expanding to llu, but to lu, which > causes the format string check to fail. Use literal and force cast until > this is debugged. We know the problem and how to fix it at this point. Though w

[PATCH] password: Fix backspace in username prompt

2021-03-04 Thread Egor Ignatov
From: Egor Ignatov Make backspace work in superuser login prompt. The problem was that bidi logical to visual ignored BN type, so you couldn't print control characters. Use grub_printf() 3 times, because if you print "\b \b" at once the cursor will get stuck on the second last character. Resol