From: David Vrabel <david.vrabel@citrix.com>
To: Chen Gang <gang.chen.5i5j@gmail.com>, <konrad.wilk@oracle.com>,
<boris.ostrovsky@oracle.com>
Cc: <xen-devel@lists.xenproject.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers/xen/grant-table.c: Be sure of unsigned value never comparing with 0
Date: Tue, 26 Aug 2014 18:03:14 +0100 [thread overview]
Message-ID: <53FCBDD2.8040208@citrix.com> (raw)
In-Reply-To: <53FCAA04.40009@gmail.com>
On 26/08/14 16:38, Chen Gang wrote:
> In grow_gnttab_list(), 'i' is 'unsigned int', and 'nr_glist_frames' may
> be 0 because 'nr_grant_frames' may be 0. So 'i' may never be less than
> 'nr_glist_frames' in failure processing, which cause infinite looping.
nr_grant_frames is at least 1. See gnttab_init().
> --- a/drivers/xen/grant-table.c
> +++ b/drivers/xen/grant-table.c
> @@ -592,8 +592,8 @@ static int grow_gnttab_list(unsigned int more_frames)
> return 0;
>
> grow_nomem:
> - for ( ; i >= nr_glist_frames; i--)
> - free_page((unsigned long) gnttab_list[i]);
> + while (i > nr_glist_frames)
> + free_page((unsigned long) gnttab_list[--i]);
while (i-- > nr_glist_frames)
...
Would have been better.
David
next prev parent reply other threads:[~2014-08-26 17:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-26 15:38 [PATCH] drivers/xen/grant-table.c: Be sure of unsigned value never comparing with 0 Chen Gang
2014-08-26 17:03 ` David Vrabel [this message]
2014-08-26 19:42 ` Chen Gang
2014-08-27 10:06 ` David Vrabel
2014-08-27 10:27 ` Chen Gang
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=53FCBDD2.8040208@citrix.com \
--to=david.vrabel@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=gang.chen.5i5j@gmail.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xenproject.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