From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 3/5] repair: handle memory allocation failure from blkmap_grow
Date: Mon, 10 Oct 2011 11:10:57 +1100 [thread overview]
Message-ID: <20111010001057.GN3159@dastard> (raw)
In-Reply-To: <20111009235126.GC13527@infradead.org>
On Sun, Oct 09, 2011 at 07:51:26PM -0400, Christoph Hellwig wrote:
> > static blkmap_t *
> > blkmap_grow(
> > - blkmap_t **blkmapp)
> > + blkmap_t *blkmap)
> > {
> > pthread_key_t key = dblkmap_key;
> > - blkmap_t *blkmap = *blkmapp;
> > + blkmap_t *new_blkmap;
> > + int new_naexts = blkmap->naexts + 4;
> >
> > if (pthread_getspecific(key) != blkmap) {
> > key = ablkmap_key;
> > ASSERT(pthread_getspecific(key) == blkmap);
> > }
> >
> > - blkmap->naexts += 4;
> > - blkmap = realloc(blkmap, BLKMAP_SIZE(blkmap->naexts));
> > - if (blkmap == NULL)
> > - do_error(_("realloc failed in blkmap_grow\n"));
> > - *blkmapp = blkmap;
> > - pthread_setspecific(key, blkmap);
> > - return blkmap;
> > + new_blkmap = realloc(blkmap, BLKMAP_SIZE(new_naexts));
> > + if (!new_blkmap) {
> > + do_error(_("realloc failed in blkmap_grow\n"));
> > + return NULL;
> > + }
> > + blkmap->naexts = new_naexts;
>
> Why would we modify naexts in the old blkmap?
Ooops. Will fix.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-10-10 0:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-09 23:11 [PATCH 0/5, v2] repair: sector size and blkmap fixes Dave Chinner
2011-10-09 23:11 ` [PATCH 1/5] repair: handle repair of image files on large sector size filesystems Dave Chinner
2011-10-09 23:52 ` Christoph Hellwig
2011-10-10 0:17 ` Dave Chinner
2011-10-10 0:19 ` Christoph Hellwig
2011-10-09 23:11 ` [PATCH 2/5] repair: fix some valgrind reported errors on i686 Dave Chinner
2011-10-09 23:45 ` Christoph Hellwig
2011-10-10 0:20 ` Dave Chinner
2011-10-10 13:14 ` Christoph Hellwig
2011-10-09 23:11 ` [PATCH 3/5] repair: handle memory allocation failure from blkmap_grow Dave Chinner
2011-10-09 23:51 ` Christoph Hellwig
2011-10-10 0:10 ` Dave Chinner [this message]
2011-10-09 23:11 ` [PATCH 4/5] repair: don't cache large blkmap allocations Dave Chinner
2011-10-09 23:48 ` Christoph Hellwig
2011-10-10 0:14 ` Dave Chinner
2011-10-10 13:22 ` Christoph Hellwig
2011-10-09 23:11 ` [PATCH 5/5] repair: prevent blkmap extent count overflows Dave Chinner
-- strict thread matches above, loose matches on Subject: below --
2011-10-10 1:08 [PATCH 0/5, v3] repair: sector size and blkmap fixes Dave Chinner
2011-10-10 1:08 ` [PATCH 3/5] repair: handle memory allocation failure from blkmap_grow Dave Chinner
2011-10-10 14:14 ` Christoph Hellwig
2011-10-13 9:57 ` Alex Elder
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=20111010001057.GN3159@dastard \
--to=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=xfs@oss.sgi.com \
/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.