Skip to contentSkip to conversation

KVM: x86: fix warning Using plain integer as NULL pointer

PATCH In review Hariprasad Kelam 3 participants 3 messages Apr 6, 2019 – Apr 8, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: x86: fix warning Using plain integer as NULL pointer

Changed passing argument as "0 to NULL" which resolves below sparse warning

arch/x86/kvm/x86.c:3096:61: warning: Using plain integer as NULL pointer

---
 arch/x86/kvm/x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
index 099b851..39034ec 100644
@@ -3093,7 +3093,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 		break;
 	case KVM_CAP_NESTED_STATE:
 		r = kvm_x86_ops->get_nested_state ?
-			kvm_x86_ops->get_nested_state(NULL, 0, 0) : 0;
+			kvm_x86_ops->get_nested_state(NULL, NULL, 0) : 0;
 		break;
 	default:
 		break;
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Hariprasad Kelam

Changed passing argument as "0 to NULL" which resolves below sparse warning

arch/x86/kvm/x86.c:3096:61: warning: Using plain integer as NULL pointer

Cheers,
-Mukesh

Quoted 17 lines
---
  arch/x86/kvm/x86.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
index 099b851..39034ec 100644
@@ -3093,7 +3093,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
  		break;
  	case KVM_CAP_NESTED_STATE:
  		r = kvm_x86_ops->get_nested_state ?
-			kvm_x86_ops->get_nested_state(NULL, 0, 0) : 0;
+			kvm_x86_ops->get_nested_state(NULL, NULL, 0) : 0;
  		break;
  	default:
  		break;
Reviewed-by on v1 1/1
#2 lore raw
In reply to Hariprasad Kelam

Nit: For future reference, wrapping the warning text with quotes in the
shortlog would be helpful. I initially read it as "fix a warning by using a plain integer as a NULL pointer". E.g.:

KVM: x86: fix warning "Using plain integer as NULL pointer"

Quoted 1 line · Hariprasad Kelam

Changed passing argument as "0 to NULL" which resolves below sparse warning

Nit: Use imperative mood to state what the patch does, as opposed to
talking about the change in the past tense. That allows using past tense to describe things that actually did happen in the past. E.g.:

Pass "NULL" instead of "0" for a pointer argument when querying KVM_CAP_NESTED_STATE to resolve the below sparse warning:

Quoted 4 lines

arch/x86/kvm/x86.c:3096:61: warning: Using plain integer as NULL pointer

Thanks for the fix!

Quoted 20 lines
---
 arch/x86/kvm/x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
index 099b851..39034ec 100644
@@ -3093,7 +3093,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 		break;
 	case KVM_CAP_NESTED_STATE:
 		r = kvm_x86_ops->get_nested_state ?
-			kvm_x86_ops->get_nested_state(NULL, 0, 0) : 0;
+			kvm_x86_ops->get_nested_state(NULL, NULL, 0) : 0;
 		break;
 	default:
 		break;
Signature · 1 line
2.7.4