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: P J P
Subject: Re: [PATCH v5 0/3] net: tulip: add checks to avoid OOB access
Date: Mon, 23 Mar 2020 11:10:49 +0530 (IST)

+-- 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)

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]