• Jerry Ray's avatar
    micrel: ksz8851: fixes struct pointer issue · fef5de75
    Jerry Ray authored
    Issue found during code review. This bug has no impact as long as the
    ks8851_net structure is the first element of the ks8851_net_spi structure.
    As long as the offset to the ks8851_net struct is zero, the container_of()
    macro is subtracting 0 and therefore no damage done. But if the
    ks8851_net_spi struct is ever modified such that the ks8851_net struct
    within it is no longer the first element of the struct, then the bug would
    manifest itself and cause problems.
    
    struct ks8851_net is contained within ks8851_net_spi.
    ks is contained within kss.
    kss is the priv_data of the netdev structure.
    Signed-off-by: default avatarJerry Ray <jerry.ray@microchip.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    fef5de75
ks8851_spi.c 12.2 KB