loader/i386/bsd: Initialize ptr variable in grub_bsd_add_meta()
commit093ac51dc6c022bbb7402ba8b632ee68325944d3
authorDaniel Kiper <daniel.kiper@oracle.com>
Thu, 10 Mar 2022 15:40:43 +0000 (10 16:40 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Mon, 14 Mar 2022 22:05:00 +0000 (14 23:05 +0100)
tree230a7603f27c3e8a0665d299f74e79123a8bc290
parent70406f432b89426e2b1ac380363697db02e84e72
loader/i386/bsd: Initialize ptr variable in grub_bsd_add_meta()

Latest GCC may complain in that way:

  In file included from ../include/grub/disk.h:31,
                   from ../include/grub/file.h:26,
                   from ../include/grub/loader.h:23,
                   from loader/i386/bsd.c:19:
  loader/i386/bsd.c: In function ‘grub_cmd_openbsd’:
  ../include/grub/misc.h:71:10: error: ‘ptr’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     71 |   return grub_memmove (dest, src, n);
        |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  loader/i386/bsd.c:266:9: note: ‘ptr’ was declared here
    266 |   void *ptr;
        |         ^~~

So, let's fix it by assigning NULL to ptr in grub_bsd_add_meta().

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
grub-core/loader/i386/bsd.c