From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
Ian Campbell <Ian.Campbell@citrix.com>,
Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] tools/libxc: Correct XC_DOM_PAGE_SIZE() to return a long long
Date: Thu, 19 Nov 2015 17:01:52 +0000 [thread overview]
Message-ID: <564E0080.1000404@citrix.com> (raw)
In-Reply-To: <20151119165041.GB5043@citrix.com>
On 19/11/15 16:50, Wei Liu wrote:
> On Thu, Nov 19, 2015 at 02:45:41PM +0000, Andrew Cooper wrote:
>> c/s abdf3c5b "libxc: create p2m list outside of kernel mapping if supported"
>> introduces a use which Coverity objects to; an int used to mask a uint64_t.
>>
>> The result needs to be signed to allow ~XC_DOM_PAGE_SIZE() to function
> $ git grep XC_DOM_PAGE_SIZE
>
> tools/libxc/include/xc_dom.h:#define XC_DOM_PAGE_SIZE(dom) (1 << (dom)->arch_hooks
> tools/libxc/include/xc_dom.h: unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
> tools/libxc/xc_dom_core.c: unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
> tools/libxc/xc_dom_core.c: unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
> tools/libxc/xc_dom_core.c: unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
> tools/libxc/xc_dom_core.c: unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
> tools/libxc/xc_dom_core.c: page_size = XC_DOM_PAGE_SIZE(dom);
> tools/libxc/xc_dom_core.c: (dom->parms.p2m_base & (XC_DOM_PAGE_SIZE(dom) - 1
> tools/libxc/xc_dom_elfloader.c: elf->dest_size = pages * XC_DOM_PAGE_SIZE(dom);
> tools/libxc/xc_dom_hvmloader.c: elf->dest_size = pages * XC_DOM_PAGE_SIZE(dom);
> tools/libxc/xc_dom_x86.c: memset(l3tab, 0, XC_DOM_PAGE_SIZE(dom));
>
> There is no use for ~XC_DOM_PAGE_SIZE.
>
> And what is the possible scenario you want that?
There might not be a current user of this in libxc, but it is a common bug.
>From xen/include/asm-x86/page.h
/*
* It is important that the masks are signed quantities. This ensures
that
* the compiler sign-extends a 32-bit mask to 64 bits if that is
required.
*/
#define PAGE_SIZE (_AC(1,L) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
#define PAGE_FLAG_MASK (~0)
#define PAGE_ORDER_4K 0
#define PAGE_ORDER_2M 9
#define PAGE_ORDER_1G 18
~Andrew
next prev parent reply other threads:[~2015-11-19 17:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-19 14:45 [PATCH] tools/libxc: Correct XC_DOM_PAGE_SIZE() to return a long long Andrew Cooper
2015-11-19 16:50 ` Wei Liu
2015-11-19 17:01 ` Andrew Cooper [this message]
2015-11-20 11:30 ` Wei Liu
2015-11-20 14:23 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=564E0080.1000404@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.