linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
To: Paul Menzel <pmenzel@molgen.mpg.de>
Cc: Wu Guanghao <wuguanghao3@huawei.com>,
	jes@trained-monkey.org, linux-raid@vger.kernel.org,
	linfeilong@huawei.com, lixiaokeng@huawei.com
Subject: Re: [PATCH 5/5] get_vd_num_of_subarray: fix memleak
Date: Tue, 7 Jun 2022 08:32:25 +0200	[thread overview]
Message-ID: <20220607083225.00006c76@linux.intel.com> (raw)
In-Reply-To: <1cbeaaa7-4b49-478a-9333-1885e8047a3f@molgen.mpg.de>

On Tue, 31 May 2022 10:25:31 +0200
Paul Menzel <pmenzel@molgen.mpg.de> wrote:

> Dear Mariusz,
> 
> 
> Am 31.05.22 um 10:11 schrieb Mariusz Tkaczyk:
> > On Tue, 31 May 2022 14:51:13 +0800 Wu Guanghao wrote:
> >   
> >> sra = sysfs_read() should be free before return in
> >> get_vd_num_of_subarray()
> >>
> >> Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
> >> ---
> >>   super-ddf.c | 9 +++++++--
> >>   1 file changed, 7 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/super-ddf.c b/super-ddf.c
> >> index 8cda23a7..827e4ae7 100644
> >> --- a/super-ddf.c
> >> +++ b/super-ddf.c
> >> @@ -1599,15 +1599,20 @@ static unsigned int get_vd_num_of_subarray(struct
> >> supertype *st) sra = sysfs_read(-1, st->devnm, GET_VERSION);
> >>   	if (!sra || sra->array.major_version != -1 ||
> >>   	    sra->array.minor_version != -2 ||
> >> -	    !is_subarray(sra->text_version))
> >> +	    !is_subarray(sra->text_version)) {
> >> +		if (sra)
> >> +			sysfs_free(sra);
> >>   		return DDF_NOTFOUND;
> >> +	}
> >>
> >>   	sub = strchr(sra->text_version + 1, '/');
> >>   	if (sub != NULL)
> >>   		vcnum = strtoul(sub + 1, &end, 10);
> >>   	if (sub == NULL || *sub == '\0' || *end != '\0' ||
> >> -	    vcnum >= be16_to_cpu(ddf->active->max_vd_entries))
> >> +	    vcnum >= be16_to_cpu(ddf->active->max_vd_entries)) {
> >> +		sysfs_free(sra);
> >>   		return DDF_NOTFOUND;
> >> +	}
> >>
> >>   	return vcnum;
> >>   }  
> > 
> > Acked-by:mariusz.tkaczyk@linux.intel.com  
> 
> Thank you for your review. The common format is:
> 
> Acked-by: Name <address>
> 
> 
Hi Paul,
Thanks, fixed.

Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>

  reply	other threads:[~2022-06-07  6:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31  6:48 [PATCH 0/5] mdadm: fix memory leak and double free Wu Guanghao
2022-05-31  6:49 ` [PATCH 1/5] parse_layout_faulty: fix memleak Wu Guanghao
2022-05-31  7:36   ` Mariusz Tkaczyk
2022-06-07  7:24     ` Wu Guanghao
2022-05-31  6:49 ` [PATCH 2/5] Detail: " Wu Guanghao
2022-05-31  7:42   ` Mariusz Tkaczyk
2022-05-31  6:50 ` [PATCH 3/5] load_imsm_mpb: fix double free Wu Guanghao
2022-05-31  7:54   ` Mariusz Tkaczyk
2022-05-31  6:50 ` [PATCH 4/5] find_disk_attached_hba: fix memleak Wu Guanghao
2022-05-31  8:04   ` Mariusz Tkaczyk
2022-06-07  7:36     ` Wu Guanghao
2022-05-31  6:51 ` [PATCH 5/5] get_vd_num_of_subarray: " Wu Guanghao
2022-05-31  8:11   ` Mariusz Tkaczyk
2022-05-31  8:25     ` Paul Menzel
2022-06-07  6:32       ` Mariusz Tkaczyk [this message]
2022-05-31  6:57 ` [PATCH 0/5] mdadm: fix memory leak and double free Paul Menzel
2022-06-07  7:39   ` Wu Guanghao

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=20220607083225.00006c76@linux.intel.com \
    --to=mariusz.tkaczyk@linux.intel.com \
    --cc=jes@trained-monkey.org \
    --cc=linfeilong@huawei.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=lixiaokeng@huawei.com \
    --cc=pmenzel@molgen.mpg.de \
    --cc=wuguanghao3@huawei.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;
as well as URLs for NNTP newsgroup(s).