public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy King <acking@vmware.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: pv-drivers@vmware.com, linux-kernel@vger.kernel.org
Subject: [PATCH] VMCI: Fix broken context ID retrieval
Date: Tue, 22 Jan 2013 09:15:04 -0800 (PST)	[thread overview]
Message-ID: <940336333.33838650.1358874904756.JavaMail.root@vmware.com> (raw)
In-Reply-To: <476743160.33828710.1358874246294.JavaMail.root@vmware.com>

I'm an idiot.  The context ID can be a really large unsigned number, which
means it'll appear negative as an int.  So actually the right fix here is just
to set it regardless of the returned value (but only for this particular
hypercall; normally we would check it).

Acked-by: Dmitry Torokhov <dtor@vmware.com>
Signed-off-by: Andy King <acking@vmware.com>
---
 drivers/misc/vmw_vmci/vmci_guest.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c
index de1a90b..60c0199 100644
--- a/drivers/misc/vmw_vmci/vmci_guest.c
+++ b/drivers/misc/vmw_vmci/vmci_guest.c
@@ -81,16 +81,13 @@ bool vmci_guest_code_active(void)
 u32 vmci_get_vm_context_id(void)
 {
 	if (vm_context_id == VMCI_INVALID_ID) {
-		int result;
 		struct vmci_datagram get_cid_msg;
 		get_cid_msg.dst =
 		    vmci_make_handle(VMCI_HYPERVISOR_CONTEXT_ID,
 				     VMCI_GET_CONTEXT_ID);
 		get_cid_msg.src = VMCI_ANON_SRC_HANDLE;
 		get_cid_msg.payload_size = 0;
-		result = vmci_send_datagram(&get_cid_msg);
-		if (result >= 0)
-			vm_context_id = result;
+		vm_context_id = vmci_send_datagram(&get_cid_msg);
 	}
 	return vm_context_id;
 }
-- 
1.7.4.1

           reply	other threads:[~2013-01-22 17:15 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <476743160.33828710.1358874246294.JavaMail.root@vmware.com>]

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=940336333.33838650.1358874904756.JavaMail.root@vmware.com \
    --to=acking@vmware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pv-drivers@vmware.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox