From: Akio Takebe Subject: [RFC] Is grant_read() runnable? Date: Wed, 25 Jan 2006 17:13:32 +0900 Message-ID: <6DC621873B343Dtakebe_akio@jp.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hi, all I think grant_read() is not runnable. " (len > (PAGE_SIZE - 200)) " is not entered into if sentence becase of len=0. So i always equal NR_GRANT_ENTRIES. Is the below patch correct? Please comment. Best Regards, Akio Takebe Signed-off-by: Akio Takebe diff -r a38c292e8390 linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c --- a/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c Tue Jan 24 16:54:34 2006 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c Wed Jan 25 17:01:03 2006 @@ -361,22 +361,22 @@ len = 0; for (i = 0; i < NR_GRANT_ENTRIES; i++) { - if (len > (PAGE_SIZE - 200)) { + if (len < (PAGE_SIZE - 200)) { len += sprintf( page + len, "Truncated.\n"); break; } - } - - if (gt[i].flags) { - len += sprintf(page + len, - "Grant: ref (0x%x) flags (0x%hx) " - "dom (0x%hx) frame (0x%x)\n", - i, - gt[i].flags, - gt[i].domid, - gt[i].frame ); - } - + + if (gt[i].flags) { + len += sprintf(page + len, + "Grant: ref (0x%x) flags (0x%hx) " + "dom (0x%hx) frame (0x%x)\n", + i, + gt[i].flags, + gt[i].domid, + gt[i].frame ); + } + + } *eof = 1; return len; }