Skip to contentSkip to conversation

VMCI: guest side driver implementation.

DISCUSSION Dan Carpenter 2 participants 2 messages Jan 10, 2013 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello George Zhang,

The patch 1f166439917b: "VMCI: guest side driver implementation." from Jan 8, 2013, leads to the following warning:
drivers/misc/vmw_vmci/vmci_guest.c:89 vmci_get_vm_context_id()

	 warn: always true condition '(result >= 0) => (0-u32max >= 0)'

drivers/misc/vmw_vmci/vmci_guest.c

    78  u32 vmci_get_vm_context_id(void)
    79  {
    80          if (vm_context_id = VMCI_INVALID_ID) {
    81                  u32 result;
    82                  struct vmci_datagram get_cid_msg;
    83                  get_cid_msg.dst     84                      vmci_make_handle(VMCI_HYPERVISOR_CONTEXT_ID,
    85                                       VMCI_GET_CONTEXT_ID);
    86                  get_cid_msg.src = VMCI_ANON_SRC_HANDLE;
    87                  get_cid_msg.payload_size = 0;
    88                  result = vmci_send_datagram(&get_cid_msg);
    89                  if (result >= 0)
                            ^^^^^^^^^^^

Always true because result is an unsigned int.

    90                          vm_context_id = result;

regards,
dan carpenter

#1 lore raw

Dan,
Thanks for this quick catch. We will fix it,
George

----- Original Message -----

Quoted 34 lines

From: "Dan Carpenter" <[email protected]>
To: [email protected]
Cc: [email protected], [email protected]
Sent: Thursday, January 10, 2013 11:32:07 AM
Subject: re: VMCI: guest side driver implementation.

Hello George Zhang,

The patch 1f166439917b: "VMCI: guest side driver implementation." from Jan 8, 2013, leads to the following warning:
drivers/misc/vmw_vmci/vmci_guest.c:89 vmci_get_vm_context_id()

	 warn: always true condition '(result >= 0) => (0-u32max >= 0)'

drivers/misc/vmw_vmci/vmci_guest.c

    78  u32 vmci_get_vm_context_id(void)
    79  {
    80          if (vm_context_id = VMCI_INVALID_ID) {
    81                  u32 result;
    82                  struct vmci_datagram get_cid_msg;
    83                  get_cid_msg.dst >     84
                         vmci_make_handle(VMCI_HYPERVISOR_CONTEXT_ID,
    85                                       VMCI_GET_CONTEXT_ID);
    86                  get_cid_msg.src = VMCI_ANON_SRC_HANDLE;
    87                  get_cid_msg.payload_size = 0;
    88                  result = vmci_send_datagram(&get_cid_msg);
    89                  if (result >= 0)
                            ^^^^^^^^^^^

Always true because result is an unsigned int.

    90                          vm_context_id = result;

regards,
dan carpenter