On Wed, Sep 14, 2022, at 11:10 PM, Nathan Huckleberry wrote: > The ndo_start_xmit field in net_device_ops is expected to be of type > netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev). > > The mismatched return type breaks forward edge kCFI since the underlying > function definition does not match the function hook definition. > > The return type of cvm_oct_xmit and cvm_oct_xmit_pow should be changed > from int to netdev_tx_t. > > Reported-by: Dan Carpenter <error27@xxxxxxxxx> > Link: https://github.com/ClangBuiltLinux/linux/issues/1703 > Cc: llvm@xxxxxxxxxxxxxxx > Signed-off-by: Nathan Huckleberry <nhuck@xxxxxxxxxx> > Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx> > > --- > > Changes v1 -> v2: > - Update function signatures in ethernet-tx.h. > > Changes v2 -> v3: > - Move changes below the scissors --- so they don't show in commit msg > - Add reviewed-by tag The patch looks correct to me so Acked-by: Arnd Bergmann <arnd@xxxxxxxx> but I have two more general comments: - For your changelogs, it would help to include the diagnostic message from smatch that you link to. - This has probably been discussed before, but why is this only reported by smatch but by clang itself when building with CFI enabled? It appears that CFI enforces stricter C++ style type compatibility on enums while the warnings only catch incompatible types according to the normal C11 rules. Arnd