public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Carlos Maiolino <cmaiolino@redhat.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH] xfsdump: Initialize getbmap structure in quantity2offset
Date: Tue, 16 Aug 2022 10:45:50 +0200	[thread overview]
Message-ID: <166063952935.40771.5357077583333371260.stgit@orion> (raw)

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;



             reply	other threads:[~2022-08-16 10:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16  8:45 Carlos Maiolino [this message]
2022-08-16 15:19 ` [PATCH] xfsdump: Initialize getbmap structure in quantity2offset Darrick J. Wong
2022-08-17  8:42   ` Carlos Maiolino
2022-08-17 15:39     ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=166063952935.40771.5357077583333371260.stgit@orion \
    --to=cmaiolino@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox