From: Chen Gang <gang.chen.5i5j@gmail.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: konrad.wilk@oracle.com, boris.ostrovsky@oracle.com,
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: Wed, 27 Aug 2014 03:42:48 +0800 [thread overview]
Message-ID: <53FCE338.1050304@gmail.com> (raw)
In-Reply-To: <53FCBDD2.8040208@citrix.com>
On 08/27/2014 01:03 AM, David Vrabel wrote:
> 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().
>
OK, thanks, that sounds reasonable to me, it is not a real wold bug, it
is my fault. :-)
>> --- 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.
>
OK, thanks, that sounds reasonable to me.
If necessary to send patch v2 (change comments and contents), please
let me know, and I shall send.
Thanks.
--
Chen Gang
Open share and attitude like air water and life which God blessed
next prev parent reply other threads:[~2014-08-26 19:43 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
2014-08-26 19:42 ` Chen Gang [this message]
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=53FCE338.1050304@gmail.com \
--to=gang.chen.5i5j@gmail.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.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