• Arnd Bergmann's avatar
    cxgb4/chcr: avoid -Wreturn-local-addr warning · 071a43e6
    Arnd Bergmann authored
    gcc-10 warns about functions that return a pointer to a stack
    variable. In chcr_write_cpl_set_tcb_ulp(), this does not actually
    happen, but it's too hard to see for the compiler:
    
    drivers/crypto/chelsio/chcr_ktls.c: In function 'chcr_write_cpl_set_tcb_ulp.constprop':
    drivers/crypto/chelsio/chcr_ktls.c:760:9: error: function may return address of local variable [-Werror=return-local-addr]
      760 |  return pos;
          |         ^~~
    drivers/crypto/chelsio/chcr_ktls.c:712:5: note: declared here
      712 |  u8 buf[48] = {0};
          |     ^~~
    
    Split the middle part of the function out into a helper to make
    it easier to understand by both humans and compilers, which avoids
    the warning.
    
    Fixes: 5a4b9fe7 ("cxgb4/chcr: complete record tx handling")
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    071a43e6
chcr_ktls.c 56.4 KB