qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v5 0/3] net: tulip: add checks to avoid OOB access


From: Jason Wang
Subject: Re: [PATCH v5 0/3] net: tulip: add checks to avoid OOB access
Date: Mon, 23 Mar 2020 18:28:48 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0


On 2020/3/23 下午1:40, P J P wrote:
+-- On Mon, 23 Mar 2020, P J P wrote --+
| +-- On Mon, 23 Mar 2020, Jason Wang wrote --+
| | hw/net/tulip.c:305:20: error: initialization of ‘_Bool (*)(NetClientState 
*)’
| | {aka ‘_Bool (*)(struct NetClientState *)’} from incompatible pointer type 
‘int
| | (*)(NetClientState *)’ {aka ‘int (*)(struct NetClientState *)’}
| | [-Werror=incompatible-pointer-types]
| |      .can_receive = tulip_can_receive,
| |                     ^~~~~~~~~~~~~~~~~
|
| Strange, I did not get it.

qemu/include/net.h:

   typedef int (NetCanReceive)(NetClientState *);

   typedef struct NetClientInfo {
     ...
     NetCanReceive *can_receive;
     ...
   }

@Jason,
   Looking at the definition above, 'NetCanReceive' is returning an 'int' type.
When I change 'tulip_can_receive' to return a 'bool', I get the reverse error

hw/net/tulip.c:305:20: error: initialization of ‘int (*)(NetClientState *)’ 
{aka ‘int (*)(struct NetClientState *)’} from incompatible pointer type ‘_Bool 
(*)(NetClientState *)’ {aka ‘_Bool (*)(struct NetClientState *)’}
[-Werror=incompatible-pointer-types]
   305 |     .can_receive = tulip_can_receive,
       |                    ^~~~~~~~~~~~~~~~~

Maybe because of a stagged local change in your tree? (to confirm)


Right, it's the conversion from int to bool done by Philippe :)

I will fix the conflict after Qiang tests it.

Thanks



Thank you.
--
Prasad J Pandit / Red Hat Product Security Team
8685 545E B54C 486B C6EB 271E E285 8B5A F050 DE8D




reply via email to

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