public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfsdump: Initialize getbmap structure in quantity2offset
@ 2022-08-16  8:45 Carlos Maiolino
  2022-08-16 15:19 ` Darrick J. Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Carlos Maiolino @ 2022-08-16  8:45 UTC (permalink / raw)
  To: linux-xfs

Prevent uninitialized data in the stack by initializing getbmap structure
to zero.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---

There is already a patch on the list to remove remaining DMAPI stuff from
xfsdump:
xfsdump: remove BMV_IF_NO_DMAPI_READ flag

This patch though, does not initialize the getbmap structure, and although
the
first struct in the array is initialized, the remaining structures in the
array are not, leaving garbage in the stack.


 dump/inomap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dump/inomap.c b/dump/inomap.c
index f3200be..c4ea21d 100644
--- a/dump/inomap.c
+++ b/dump/inomap.c
@@ -1627,7 +1627,7 @@ static off64_t
 quantity2offset(jdm_fshandle_t *fshandlep, struct xfs_bstat *statp, off64_t qty)
 {
 	int fd;
-	struct getbmap bmap[BMAP_LEN];
+	struct getbmap bmap[BMAP_LEN] = {0};
 	off64_t offset;
 	off64_t offset_next;
 	off64_t qty_accum;



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-17 15:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-16  8:45 [PATCH] xfsdump: Initialize getbmap structure in quantity2offset Carlos Maiolino
2022-08-16 15:19 ` Darrick J. Wong
2022-08-17  8:42   ` Carlos Maiolino
2022-08-17 15:39     ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox