]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
xen-gntalloc: signedness bug in add_grefs()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 4 Nov 2011 18:24:36 +0000 (21:24 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 21 Nov 2011 22:35:26 +0000 (14:35 -0800)
commit 99cb2ddcc617f43917e94a4147aa3ccdb2bcd77e upstream.

gref->gref_id is unsigned so the error handling didn't work.
gnttab_grant_foreign_access() returns an int type, so we can add a
cast here, and it doesn't cause any problems.
gnttab_grant_foreign_access() can return a variety of errors
including -ENOSPC, -ENOSYS and -ENOMEM.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/xen/gntalloc.c

index 23c60cf4313ed26095bb2e0e93bab5064fb22b11..e1c4c6e5b469c44449f68e9e841d264eb08dbc48 100644 (file)
@@ -135,7 +135,7 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op,
                /* Grant foreign access to the page. */
                gref->gref_id = gnttab_grant_foreign_access(op->domid,
                        pfn_to_mfn(page_to_pfn(gref->page)), readonly);
-               if (gref->gref_id < 0) {
+               if ((int)gref->gref_id < 0) {
                        rc = gref->gref_id;
                        goto undo;
                }