* [PATCH v1] x86/domctl: remove impossible condition in XEN_DOMCTL_getpageframeinfo3
@ 2018-03-09 16:01 Olaf Hering
2018-03-09 16:02 ` Andrew Cooper
2018-03-09 16:07 ` Wei Liu
0 siblings, 2 replies; 4+ messages in thread
From: Olaf Hering @ 2018-03-09 16:01 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Olaf Hering, Jan Beulich
The value of num is always the same as domctl->u.getpageframeinfo3.num,
it was assigned just a few lines before.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
xen/arch/x86/domctl.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 8fbbf3aeb3..46d288a490 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -421,8 +421,7 @@ long arch_do_domctl(
/* Games to allow this code block to handle a compat guest. */
void __user *guest_handle = domctl->u.getpageframeinfo3.array.p;
- if ( unlikely(num > 1024) ||
- unlikely(num != domctl->u.getpageframeinfo3.num) )
+ if ( unlikely(num > 1024) )
{
ret = -E2BIG;
break;
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v1] x86/domctl: remove impossible condition in XEN_DOMCTL_getpageframeinfo3
2018-03-09 16:01 [PATCH v1] x86/domctl: remove impossible condition in XEN_DOMCTL_getpageframeinfo3 Olaf Hering
@ 2018-03-09 16:02 ` Andrew Cooper
2018-03-09 16:09 ` Olaf Hering
2018-03-09 16:07 ` Wei Liu
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2018-03-09 16:02 UTC (permalink / raw)
To: Olaf Hering, xen-devel; +Cc: Jan Beulich
On 09/03/18 16:01, Olaf Hering wrote:
> The value of num is always the same as domctl->u.getpageframeinfo3.num,
> it was assigned just a few lines before.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
This isn't dead code. It is a truncation check.
~Andrew
> ---
> xen/arch/x86/domctl.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
> index 8fbbf3aeb3..46d288a490 100644
> --- a/xen/arch/x86/domctl.c
> +++ b/xen/arch/x86/domctl.c
> @@ -421,8 +421,7 @@ long arch_do_domctl(
> /* Games to allow this code block to handle a compat guest. */
> void __user *guest_handle = domctl->u.getpageframeinfo3.array.p;
>
> - if ( unlikely(num > 1024) ||
> - unlikely(num != domctl->u.getpageframeinfo3.num) )
> + if ( unlikely(num > 1024) )
> {
> ret = -E2BIG;
> break;
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v1] x86/domctl: remove impossible condition in XEN_DOMCTL_getpageframeinfo3
2018-03-09 16:02 ` Andrew Cooper
@ 2018-03-09 16:09 ` Olaf Hering
0 siblings, 0 replies; 4+ messages in thread
From: Olaf Hering @ 2018-03-09 16:09 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Jan Beulich, xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 435 bytes --]
On Fri, Mar 09, Andrew Cooper wrote:
> On 09/03/18 16:01, Olaf Hering wrote:
> > The value of num is always the same as domctl->u.getpageframeinfo3.num,
> > it was assigned just a few lines before.
> >
> > Signed-off-by: Olaf Hering <olaf@aepfle.de>
>
> This isn't dead code. It is a truncation check.
How can this happen, other than num being a 32bit type?
Perhaps the type of num should match the type of i?
Olaf
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 157 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] x86/domctl: remove impossible condition in XEN_DOMCTL_getpageframeinfo3
2018-03-09 16:01 [PATCH v1] x86/domctl: remove impossible condition in XEN_DOMCTL_getpageframeinfo3 Olaf Hering
2018-03-09 16:02 ` Andrew Cooper
@ 2018-03-09 16:07 ` Wei Liu
1 sibling, 0 replies; 4+ messages in thread
From: Wei Liu @ 2018-03-09 16:07 UTC (permalink / raw)
To: Olaf Hering; +Cc: Andrew Cooper, Wei Liu, Jan Beulich, xen-devel
On Fri, Mar 09, 2018 at 05:01:16PM +0100, Olaf Hering wrote:
> The value of num is always the same as domctl->u.getpageframeinfo3.num,
> it was assigned just a few lines before.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
It is still useful. The field in getpageframeinfo3 is uint64_aligned_t
while here num is just unsigned int. The check makes sure no truncation
happens.
> ---
> xen/arch/x86/domctl.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
> index 8fbbf3aeb3..46d288a490 100644
> --- a/xen/arch/x86/domctl.c
> +++ b/xen/arch/x86/domctl.c
> @@ -421,8 +421,7 @@ long arch_do_domctl(
> /* Games to allow this code block to handle a compat guest. */
> void __user *guest_handle = domctl->u.getpageframeinfo3.array.p;
>
> - if ( unlikely(num > 1024) ||
> - unlikely(num != domctl->u.getpageframeinfo3.num) )
> + if ( unlikely(num > 1024) )
> {
> ret = -E2BIG;
> break;
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xenproject.org
> https://lists.xenproject.org/mailman/listinfo/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-09 16:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-09 16:01 [PATCH v1] x86/domctl: remove impossible condition in XEN_DOMCTL_getpageframeinfo3 Olaf Hering
2018-03-09 16:02 ` Andrew Cooper
2018-03-09 16:09 ` Olaf Hering
2018-03-09 16:07 ` Wei Liu
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.