* [patch 2/2] xen-gntalloc: signedness bug in add_grefs()
@ 2011-11-04 18:24 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2011-11-04 18:24 UTC (permalink / raw)
To: Jeremy Fitzhardinge
Cc: kernel-janitors, xen-devel, virtualization, Konrad Rzeszutek Wilk
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>
diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c
index 23c60cf..e1c4c6e 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;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-11-04 18:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-04 18:24 [patch 2/2] xen-gntalloc: signedness bug in add_grefs() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox