Bugzilla – Bug 1218949
GCC 14: grub2 package fails - malloc(sizeof(_pointer_))
Last modified: 2024-05-17 09:10:50 UTC
Building grub2 with GCC 14 discovered several incorrect mallocs (using sizeof pointer, instead of the struct): https://build.opensuse.org/package/live_build_log/devel:gcc:next:testing/grub2/devel_gcc_next_openSUSE_Tumbleweed/x86_64 [ 73s] In file included from ../grub-core/osdep/ofpath.c:2: [ 73s] ../grub-core/osdep/linux/ofpath.c: In function 'of_find_fc_host': [ 73s] ../grub-core/osdep/linux/ofpath.c:427:22: error: allocation of insufficient size '8' for type 'struct ofpath_files_list_root' with size '16' [-Werror=alloc-size] [ 73s] 427 | portnames_file_list=malloc(sizeof(portnames_file_list)); [ 73s] | ^ [ 73s] ../grub-core/osdep/linux/ofpath.c: In function 'of_path_of_nvme': [ 73s] ../grub-core/osdep/linux/ofpath.c:589:21: error: allocation of insufficient size '8' for type 'struct ofpath_nvmeof_info' with size '32' [-Werror=alloc-size] [ 73s] 589 | nvmeof_info = malloc(sizeof(nvmeof_info)); [ 73s] | ^ [ 73s] ../grub-core/osdep/linux/ofpath.c:618:21: error: allocation of insufficient size '8' for type 'struct ofpath_nvmeof_info' with size '32' [-Werror=alloc-size] [ 73s] 618 | nvmeof_info = malloc(sizeof(nvmeof_info)); [ 73s] | ^ All these mallocs come from: 0002-ieee1275-ofpath-enable-NVMeoF-logical-device-transla.patch Fix should be simple: - nvmeof_info = malloc(sizeof(nvmeof_info)); + nvmeof_info = malloc(sizeof(*nvmeof_info));
Hello SUSE, I have mirrored this bug to IBM LTC Bug 205032. The IBM team update about it will show up here. Thank you for your support.
The fix has been submitted to factory. https://build.opensuse.org/request/show/1144467/changes
------- Comment From AVNISH.CHOUHAN@ibm.com 2024-02-07 03:35 EDT------- Hi Michael, We have done refinements on the NVMeOF patch series and sent to upstream "https://lists.gnu.org/archive/html/grub-devel/2023-05/msg00024.html". Waiting for review comments and acceptance of this NVMeOF patch series upstream. Thank you, Avnish Chouhan
(In reply to LTC BugProxy from comment #8) > ------- Comment From AVNISH.CHOUHAN@ibm.com 2024-02-07 03:35 EDT------- > Hi Michael, > > We have done refinements on the NVMeOF patch series and sent to upstream > "https://lists.gnu.org/archive/html/grub-devel/2023-05/msg00024.html". > Waiting for review comments and acceptance of this NVMeOF patch series > upstream. > > Thank you, > Avnish Chouhan We have marked this bug report as closed, as the patch addressing the issue with $subject has been successfully submitted to openSUSE. Should there be a need to incorporate the PPC NVMEoF patch into the latest upstream version, please feel free to open a new bug report. Your feedback and contributions are always welcome.