diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2011-11-04 21:24:36 +0300 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-11-09 09:16:35 -0500 |
commit | 0247eaf96252353a760cbd3975dd6ef0f57379b3 (patch) | |
tree | e1962454fc6aa06c90725f65d89fa714beb51ee2 | |
parent | b6acdcdc24856f9fc05560172ccd753d186c0c44 (diff) | |
download | xen-0247eaf96252353a760cbd3975dd6ef0f57379b3.tar.gz |
xen-gntalloc: signedness bug in add_grefs()
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.
CC: stable@kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r-- | drivers/xen/gntalloc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c index 23c60cf4313ed..e1c4c6e5b469c 100644 --- a/drivers/xen/gntalloc.c +++ b/drivers/xen/gntalloc.c @@ -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; } |