qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/3] net/vmxnet3: return 1 on device activation


From: P J P
Subject: Re: [Qemu-devel] [PATCH 1/3] net/vmxnet3: return 1 on device activation failure
Date: Mon, 21 Dec 2015 23:45:38 +0530 (IST)

+-- On Mon, 21 Dec 2015, Miao Yan wrote --+
| So return 1 on device activation failure instead of -1;
| 
| Signed-off-by: Miao Yan <address@hidden>
| ---
|  hw/net/vmxnet3.c | 2 +-
|  1 file changed, 1 insertion(+), 1 deletion(-)
| 
| diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
| index e168285..9185408 100644
| --- a/hw/net/vmxnet3.c
| +++ b/hw/net/vmxnet3.c
| @@ -1652,7 +1652,7 @@ static uint64_t vmxnet3_get_command_status(VMXNET3State 
*s)
|  
|      switch (s->last_command) {
|      case VMXNET3_CMD_ACTIVATE_DEV:
| -        ret = (s->device_active) ? 0 : -1;
| +        ret = (s->device_active) ? 0 : 1;
|          VMW_CFPRN("Device active: %" PRIx64, ret);
|          break;

  It seems okay. Considering that the function returns 'uint64_t', -1 would 
become an extremely large value. I wonder if that is intended.

If '1' indicates the error, the 'default:' case in the same switch needs to be 
updated too.

  default:                                                                    
        VMW_WRPRN("Received request for unknown command: %x", s->last_command); 
        ret = -1;                                                               
        break;


Why does the function return 'uint64_t' type? All return values from other 
cases seem to be within uint32_t type.

--
Prasad J Pandit / Red Hat Product Security Team
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F



reply via email to

[Prev in Thread] Current Thread [Next in Thread]