Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "\"Zhou, Wenjian/周文剑\"" <zhouwj-fnst@cn.fujitsu.com>
To: kexec@lists.infradead.org
Subject: Re: [PATCH] makedumpfile: Fix the variable pfn_needed leaking
Date: Tue, 11 Nov 2014 17:29:23 +0800	[thread overview]
Message-ID: <5461D6F3.6050909@cn.fujitsu.com> (raw)
In-Reply-To: <1415696079-29701-1-git-send-email-mhuang@redhat.com>

On 11/11/2014 04:54 PM, Minfei Huang wrote:
> If the page pfn calculated by read_from_splitblock_table is bigger than
> pfn_needed, the variable pfn_needed will leak.
>
> makedumpfile cannot assign the pfn averagely bacause of condition
> pfn_needed invalid.
>
> Signed-off-by: Minfei Huang<mhuang@redhat.com>
> ---
>   makedumpfile.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/makedumpfile.c b/makedumpfile.c
> index 59c4952..8807a90 100644
> --- a/makedumpfile.c
> +++ b/makedumpfile.c
> @@ -8415,7 +8415,7 @@ calculate_end_pfn_by_splitblock(mdf_pfn_t start_pfn,
>   		return info->max_mapnr;
>
>   	mdf_pfn_t end_pfn;
> -	long long pfn_needed, offset;
> +	long long pfn_needed, offset, per_splitblock_pfn;
>   	char *splitblock_value_offset;
>
>   	pfn_needed = info->num_dumpable / info->num_dumpfile;
> @@ -8424,7 +8424,8 @@ calculate_end_pfn_by_splitblock(mdf_pfn_t start_pfn,
>   	end_pfn = start_pfn;
>
>   	while (*cur_splitblock_num<  splitblock->num&&  pfn_needed>  0) {
> -		pfn_needed -= read_from_splitblock_table(splitblock_value_offset);
> +		per_splitblock_pfn = read_from_splitblock_table(splitblock_value_offset);
> +		pfn_needed = pfn_needed<  per_splitblock_pfn ? 0 : pfn_needed - per_splitblock_pfn;
>   		splitblock_value_offset += splitblock->entry_size;
>   		++*cur_splitblock_num;
>   	}

Hello Huang,

Actually, pfn_needed is used to indicate whether the dumpfile have enough pfn or not.
It doesn't matter whether pfn_needed == 0 or pfn_needed < 0.

I know what you want to express. Maybe you can get some useful information at
http://lists.infradead.org/pipermail/kexec/2014-October/012805.html

-- 
Thanks
Zhou Wenjian

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2014-11-11  9:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-11  8:54 [PATCH] makedumpfile: Fix the variable pfn_needed leaking Minfei Huang
2014-11-11  9:29 ` "Zhou, Wenjian/周文剑" [this message]
2014-11-12 12:05 ` Minfei Huang
2014-11-13  0:59   ` "Zhou, Wenjian/周文剑"
2014-11-13  2:06     ` Minfei Huang

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=5461D6F3.6050909@cn.fujitsu.com \
    --to=zhouwj-fnst@cn.fujitsu.com \
    --cc=kexec@lists.infradead.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