public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-next] KVM: x86: Replace IS_ERR() with IS_ERR_VALUE()
@ 2022-10-20 11:39 yexingchen116
  2022-10-20 17:37 ` Sean Christopherson
  2022-11-07 17:30 ` H. Peter Anvin
  0 siblings, 2 replies; 5+ messages in thread
From: yexingchen116 @ 2022-10-20 11:39 UTC (permalink / raw)
  To: seanjc
  Cc: pbonzini, tglx, mingo, bp, dave.hansen, x86, hpa, kvm,
	linux-kernel, ye xingchen

From: ye xingchen <ye.xingchen@zte.com.cn>

Avoid type casts that are needed for IS_ERR() and use
IS_ERR_VALUE() instead.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 arch/x86/kvm/x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4bd5f8a751de..1c260f716c3b 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -12414,7 +12414,7 @@ void __user * __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa,
 		 */
 		hva = vm_mmap(NULL, 0, size, PROT_READ | PROT_WRITE,
 			      MAP_SHARED | MAP_ANONYMOUS, 0);
-		if (IS_ERR((void *)hva))
+		if (IS_ERR_VALUE(hva))
 			return (void __user *)hva;
 	} else {
 		if (!slot || !slot->npages)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH linux-next] KVM: x86: Replace IS_ERR() with IS_ERR_VALUE()
  2022-10-20 11:39 [PATCH linux-next] KVM: x86: Replace IS_ERR() with IS_ERR_VALUE() yexingchen116
@ 2022-10-20 17:37 ` Sean Christopherson
  2022-11-07 17:30 ` H. Peter Anvin
  1 sibling, 0 replies; 5+ messages in thread
From: Sean Christopherson @ 2022-10-20 17:37 UTC (permalink / raw)
  To: yexingchen116
  Cc: pbonzini, tglx, mingo, bp, dave.hansen, x86, hpa, kvm,
	linux-kernel, ye xingchen

On Thu, Oct 20, 2022, yexingchen116@gmail.com wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
> 
> Avoid type casts that are needed for IS_ERR() and use
> IS_ERR_VALUE() instead.
> 
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> ---

Ignoring until things get sorted out.

https://lore.kernel.org/r/Y1EVnZS9BalesrC1@kroah.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH linux-next] KVM: x86: Replace IS_ERR() with IS_ERR_VALUE()
  2022-10-20 11:39 [PATCH linux-next] KVM: x86: Replace IS_ERR() with IS_ERR_VALUE() yexingchen116
  2022-10-20 17:37 ` Sean Christopherson
@ 2022-11-07 17:30 ` H. Peter Anvin
  1 sibling, 0 replies; 5+ messages in thread
From: H. Peter Anvin @ 2022-11-07 17:30 UTC (permalink / raw)
  To: yexingchen116, seanjc
  Cc: pbonzini, tglx, mingo, bp, dave.hansen, x86, kvm, linux-kernel,
	ye xingchen

On 10/20/22 04:39, yexingchen116@gmail.com wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
> 
> Avoid type casts that are needed for IS_ERR() and use
> IS_ERR_VALUE() instead.
> 
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> ---
>   arch/x86/kvm/x86.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 4bd5f8a751de..1c260f716c3b 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -12414,7 +12414,7 @@ void __user * __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa,
>   		 */
>   		hva = vm_mmap(NULL, 0, size, PROT_READ | PROT_WRITE,
>   			      MAP_SHARED | MAP_ANONYMOUS, 0);
> -		if (IS_ERR((void *)hva))
> +		if (IS_ERR_VALUE(hva))
>   			return (void __user *)hva;
>   	} else {
>   		if (!slot || !slot->npages)

This seems to imply IS_ERR() is misdesigned.

It would be nice to have IS_ERR() contain the appropriate casts. If we 
want to enforce that the argument is a pointer, add IS_ERR_PTR()?

	-hpa

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH linux-next] KVM: x86: Replace IS_ERR() with IS_ERR_VALUE()
@ 2022-11-16  9:18 ye.xingchen
  2023-01-28  0:05 ` Sean Christopherson
  0 siblings, 1 reply; 5+ messages in thread
From: ye.xingchen @ 2022-11-16  9:18 UTC (permalink / raw)
  To: seanjc; +Cc: pbonzini, tglx, mingo, bp, dave.hansen, x86, hpa, kvm,
	linux-kernel

From: ye xingchen <ye.xingchen@zte.com.cn>

Avoid type casts that are needed for IS_ERR() and use
IS_ERR_VALUE() instead.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 arch/x86/kvm/x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index aa39e6c2d1f1..c2eaa9b8d2cb 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -12483,7 +12483,7 @@ void __user * __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa,
 		 */
 		hva = vm_mmap(NULL, 0, size, PROT_READ | PROT_WRITE,
 			      MAP_SHARED | MAP_ANONYMOUS, 0);
-		if (IS_ERR((void *)hva))
+		if (IS_ERR_VALUE(hva))
 			return (void __user *)hva;
 	} else {
 		if (!slot || !slot->npages)
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH linux-next] KVM: x86: Replace IS_ERR() with IS_ERR_VALUE()
  2022-11-16  9:18 ye.xingchen
@ 2023-01-28  0:05 ` Sean Christopherson
  0 siblings, 0 replies; 5+ messages in thread
From: Sean Christopherson @ 2023-01-28  0:05 UTC (permalink / raw)
  To: Sean Christopherson, ye.xingchen
  Cc: pbonzini, tglx, mingo, bp, dave.hansen, x86, hpa, kvm,
	linux-kernel

On Wed, 16 Nov 2022 17:18:43 +0800, ye.xingchen@zte.com.cn wrote:
> Avoid type casts that are needed for IS_ERR() and use
> IS_ERR_VALUE() instead.
> 
> 

Applied to kvm-x86 misc, thanks!

[1/1] KVM: x86: Replace IS_ERR() with IS_ERR_VALUE()
      https://github.com/kvm-x86/linux/commit/2eb398df77a1

--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-28  0:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-20 11:39 [PATCH linux-next] KVM: x86: Replace IS_ERR() with IS_ERR_VALUE() yexingchen116
2022-10-20 17:37 ` Sean Christopherson
2022-11-07 17:30 ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2022-11-16  9:18 ye.xingchen
2023-01-28  0:05 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox