Thomas,
On 3/24/20 7:51 AM, Paul Menzel wrote: > Dear PGNet Dev, > > > Already reported and analyzed [1]. It’d be nice, if you could verify Thomas’ > analysis. not sure I'm reading your intent from your post, > ... > I think that the following expression produces the same number without > virtual access to a virtual array member: > > (char *) &sb.dev_roles - (char *) sb > + grub_le_to_cpu32 (sb.dev_number) * sizeof(grub_uint16_t) > ... with this, diff -ur grub.ORIG/grub-core/disk/mdraid1x_linux.c grub/grub-core/disk/mdraid1x_linux.c --- grub.ORIG/grub-core/disk/mdraid1x_linux.c 2020-03-24 09:24:08.656640265 -0700 +++ grub/grub-core/disk/mdraid1x_linux.c 2020-03-24 09:25:20.615871693 -0700 @@ -178,8 +178,9 @@ return NULL; if (grub_disk_read (disk, sector, - (char *) &sb.dev_roles[grub_le_to_cpu32 (sb.dev_number)] - - (char *) &sb, + (char *) &sb.dev_roles + - (char *) sb + + grub_le_to_cpu32 (sb.dev_number) * sizeof(grub_uint16_t), sizeof (role), &role)) return NULL; I'm seeing, ... gcc -DHAVE_CONFIG_H -I. -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub-core/disk/mdraid1x_linux.c\" -I. -I. -I. -I. -I./include -I./include -I./grub-core/lib/libgcrypt-grub/src/ -I./grub-core/lib/minilzo -I./grub-core/lib/xzembed -I./grub-core/lib/zstd -DMINILZO_HAVE_CONFIG_H -O3 -Wall -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fmessage-length=0 -grecord-gcc-switches -march=native -mtune=native -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Werror -fno-builtin -Wno-undef -O3 -Wall -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fmessage-length=0 -grecord-gcc-switches -march=native -mtune=native -MT grub-core/disk/libgrubmods_a-mdraid1x_linux.o -MD -MP -MF grub-core/disk/.deps-util/libgrubmods_a-mdraid1x_linux.Tpo -c -o grub-core/disk/libgrubmods_a-mdraid1x_linux.o `test -f 'grub-core/disk/mdraid1x_linux.c' || echo './'`grub-core/disk/mdraid1x_linux.c grub-core/disk/mdraid1x_linux.c: In function ‘grub_mdraid_detect’: grub-core/disk/mdraid1x_linux.c:183:6: error: cannot convert to a pointer type 183 | + grub_le_to_cpu32 (sb.dev_number) * sizeof(grub_uint16_t), | ^ make[2]: *** [Makefile:7059: grub-core/disk/libgrubmods_a-mdraid1x_linux.o] Error 1 my patch attempt wrong? or still needs tweaks? _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel