[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxc: Have xc_translate_foreign_address() set errno properly
commit 80c4b4c1785aab8053a27931c188c4311189d32d Author: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx> AuthorDate: Thu Mar 3 15:58:00 2016 +0200 Commit: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> CommitDate: Wed Mar 16 04:58:39 2016 -0400 libxc: Have xc_translate_foreign_address() set errno properly Currently it's possible for xc_translate_foreign_address() to fail and errno still be set to success. This patch fixes the issue. Based on the first half of Don Slutz' patch: http://lists.xen.org/archives/html/xen-devel/2014-03/msg03720.html Signed-off-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxc/xc_pagetab.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/libxc/xc_pagetab.c b/tools/libxc/xc_pagetab.c index ec97890..92eebd6 100644 --- a/tools/libxc/xc_pagetab.c +++ b/tools/libxc/xc_pagetab.c @@ -88,8 +88,10 @@ unsigned long xc_translate_foreign_address(xc_interface *xch, uint32_t dom, return 0; memcpy(&pte, map + (paddr & (PAGE_SIZE - 1)), size); munmap(map, PAGE_SIZE); - if (!(pte & 1)) + if (!(pte & 1)) { + errno = EADDRNOTAVAIL; return 0; + } paddr = pte & 0x000ffffffffff000ull; if (level == 2 && (pte & PTE_PSE)) { mask = ((mask ^ ~-mask) >> 1); /* All bits below first set bit */ -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |