From: Bill O'Donnell <bodonnel@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-xfs@vger.kernel.org, cmaiolino@redhat.com
Subject: Re: [PATCH 2/4] xfs_db: fix unitialized variable ifake->if_levels
Date: Thu, 13 Jun 2024 13:58:39 -0500 [thread overview]
Message-ID: <ZmtBXwlJ3VhJJttV@redhat.com> (raw)
In-Reply-To: <Zms8Q0TYysO2w39p@infradead.org>
On Thu, Jun 13, 2024 at 11:36:51AM -0700, Christoph Hellwig wrote:
> On Thu, Jun 13, 2024 at 01:07:06PM -0500, Bill O'Donnell wrote:
> > Initialize if_levels to 0.
> >
> > Coverity-id: 1596600, 1596597
> >
> > Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
> > ---
> > db/bmap_inflate.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/db/bmap_inflate.c b/db/bmap_inflate.c
> > index 33b0c954..8232f486 100644
> > --- a/db/bmap_inflate.c
> > +++ b/db/bmap_inflate.c
> > @@ -351,6 +351,7 @@ build_new_datafork(
> > /* Set up staging for the new bmbt */
> > ifake.if_fork = kmem_cache_zalloc(xfs_ifork_cache, 0);
> > ifake.if_fork_size = xfs_inode_fork_size(ip, XFS_DATA_FORK);
> > + ifake.if_levels = 0;
> > bmap_cur = libxfs_bmbt_stage_cursor(ip->i_mount, ip, &ifake);
> >
> > /*
> > @@ -404,6 +405,7 @@ estimate_size(
> >
> > ifake.if_fork = kmem_cache_zalloc(xfs_ifork_cache, 0);
> > ifake.if_fork_size = xfs_inode_fork_size(ip, XFS_DATA_FORK);
> > + ifake.if_levels = 0;
>
> Maybe initialize it at declaration time by doing:
>
> struct xbtree_ifakeroot ifake = { };
>
> to future-proof against adding more fields?
>
Makes sense, I'll send a new version.
Thanks-
Bill
next prev parent reply other threads:[~2024-06-13 18:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-13 18:07 [PATCH 0/4] xfsprogs: coverity fixes Bill O'Donnell
2024-06-13 18:07 ` [PATCH 1/4] mkfs.xfs: avoid potential overflowing expression in xfs_mkfs.c Bill O'Donnell
2024-06-13 18:35 ` Christoph Hellwig
2024-06-13 18:07 ` [PATCH 2/4] xfs_db: fix unitialized variable ifake->if_levels Bill O'Donnell
2024-06-13 18:36 ` Christoph Hellwig
2024-06-13 18:58 ` Bill O'Donnell [this message]
2024-06-13 18:07 ` [PATCH 3/4] xfs_fsr: correct type in fsrprintf() call Bill O'Donnell
2024-06-13 18:37 ` Christoph Hellwig
2024-06-13 18:07 ` [PATCH 4/4] xfs_repair: correct type of variable global_msgs.interval to time_t Bill O'Donnell
2024-06-13 18:38 ` Christoph Hellwig
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=ZmtBXwlJ3VhJJttV@redhat.com \
--to=bodonnel@redhat.com \
--cc=cmaiolino@redhat.com \
--cc=hch@infradead.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.