From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Subject: [PATCH] memory: fix XSA-158 fix
Date: Wed, 09 Dec 2015 03:53:10 -0700 [thread overview]
Message-ID: <5668162602000078000BD8A0@prv-mh.provo.novell.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]
For one the uses of domu_max_order and ptdom_max_order were swapped.
And then gcc warns about an unused result of a __must_check function
in the control part of a conditional expression when both other
expressions can be determined by the compiler to produce the same value
(see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68039), which happens
when HAS_PASSTHROUGH is undefined (i.e. for ARM on 4.4 and older).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -55,8 +55,6 @@ static unsigned int __read_mostly ctldom
static unsigned int __read_mostly hwdom_max_order = CONFIG_HWDOM_MAX_ORDER;
#ifdef HAS_PASSTHROUGH
static unsigned int __read_mostly ptdom_max_order = CONFIG_PTDOM_MAX_ORDER;
-#else
-# define ptdom_max_order domu_max_order
#endif
static void __init parse_max_order(const char *s)
{
@@ -75,8 +73,12 @@ custom_param("memop-max-order", parse_ma
static unsigned int max_order(const struct domain *d)
{
- unsigned int order = cache_flush_permitted(d) ? domu_max_order
- : ptdom_max_order;
+ unsigned int order = domu_max_order;
+
+#ifdef HAS_PASSTHROUGH
+ if ( cache_flush_permitted(d) && order < ptdom_max_order )
+ order = ptdom_max_order;
+#endif
if ( is_control_domain(d) && order < ctldom_max_order )
order = ctldom_max_order;
[-- Attachment #2: gcc-bug-68039-workaround.patch --]
[-- Type: text/plain, Size: 1455 bytes --]
memory: fix XSA-158 fix
For one the uses of domu_max_order and ptdom_max_order were swapped.
And then gcc warns about an unused result of a __must_check function
in the control part of a conditional expression when both other
expressions can be determined by the compiler to produce the same value
(see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68039), which happens
when HAS_PASSTHROUGH is undefined (i.e. for ARM on 4.4 and older).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -55,8 +55,6 @@ static unsigned int __read_mostly ctldom
static unsigned int __read_mostly hwdom_max_order = CONFIG_HWDOM_MAX_ORDER;
#ifdef HAS_PASSTHROUGH
static unsigned int __read_mostly ptdom_max_order = CONFIG_PTDOM_MAX_ORDER;
-#else
-# define ptdom_max_order domu_max_order
#endif
static void __init parse_max_order(const char *s)
{
@@ -75,8 +73,12 @@ custom_param("memop-max-order", parse_ma
static unsigned int max_order(const struct domain *d)
{
- unsigned int order = cache_flush_permitted(d) ? domu_max_order
- : ptdom_max_order;
+ unsigned int order = domu_max_order;
+
+#ifdef HAS_PASSTHROUGH
+ if ( cache_flush_permitted(d) && order < ptdom_max_order )
+ order = ptdom_max_order;
+#endif
if ( is_control_domain(d) && order < ctldom_max_order )
order = ctldom_max_order;
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next reply other threads:[~2015-12-09 10:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-09 10:53 Jan Beulich [this message]
2015-12-09 11:02 ` [PATCH] memory: fix XSA-158 fix Ian Campbell
2015-12-09 11:10 ` Jan Beulich
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=5668162602000078000BD8A0@prv-mh.provo.novell.com \
--to=jbeulich@suse.com \
--cc=xen-devel@lists.xenproject.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.