public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Tinguely <tinguely@sgi.com>
To: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Chandra Seetharaman <sekharan@us.ibm.com>, xfsprogs <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfsprogs: fix potential memory leak in verify_set_primary_sb()
Date: Tue, 24 Sep 2013 13:59:49 -0500	[thread overview]
Message-ID: <5241E125.7010902@sgi.com> (raw)
In-Reply-To: <1379829679.4089.2.camel@ThinkPad-T5421>

On 09/22/13 01:01, Li Zhong wrote:
> This patch tries to fix CID 997012, 997013 and 997014 reported by Coverity scan,
> as suggested by sekharan.
>
> Signed-off-by: Li Zhong<zhong@linux.vnet.ibm.com>
> ---


> @@ -756,8 +756,10 @@ verify_set_primary_sb(xfs_sb_t		*rsb,
>   	/*
>   	 * see if we have enough superblocks to bother with
>   	 */
> -	if (num_ok < num_sbs / 2)
> -		return(XR_INSUFF_SEC_SB);
> +	if (num_ok < num_sbs / 2) {
> +		retval = XR_INSUFF_SEC_SB;
> +		goto out_free_list;
> +	}

>

Looks good. list, sb and check could have been allocated at this point.

Isn't the list been added to before the conditional in the for loop?:

         list = add_geo(list, &geo, sb_index);

         /*
          * grab N secondaries.  check them off as we get them
          * so we only process each one once
          */
         for (round = 0; round < skip; round++)  {

...
                         if (get_sb(sb, off, size, agno) == XR_EOF)  {
                                 retval = 1;
                                 goto out;
				^^^^^^^^^ out_free_list?
                         }

--Mark.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2013-09-24 18:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-22  6:01 [PATCH] xfsprogs: fix potential memory leak in verify_set_primary_sb() Li Zhong
2013-09-24 18:59 ` Mark Tinguely [this message]
2013-09-25  7:32   ` [PATCH v2] " Li Zhong
2013-09-25 13:26     ` Mark Tinguely
2013-09-25 14:28     ` Eric Sandeen
2013-09-26  6:41       ` Li Zhong
2013-09-26  6:45       ` [PATCH v3 1/2] " Li Zhong
2013-09-26  6:48         ` [PATCH 2/2] xfsprogs: fix return value of verify_set_primary_sb() Li Zhong
2013-09-26 14:43           ` Eric Sandeen
2013-10-18 16:42           ` Rich Johnston
2013-09-26 14:31         ` [PATCH v3 1/2] xfsprogs: fix potential memory leak in verify_set_primary_sb() Eric Sandeen
2013-09-27  3:05           ` Li Zhong
2013-09-27  3:24             ` Eric Sandeen
2013-09-27  5:24               ` Li Zhong
2013-10-18 16:40         ` Rich Johnston
2013-09-25  7:34   ` [PATCH] " Li Zhong

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=5241E125.7010902@sgi.com \
    --to=tinguely@sgi.com \
    --cc=sekharan@us.ibm.com \
    --cc=xfs@oss.sgi.com \
    --cc=zhong@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox