]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
cxgb4/chcr: avoid -Wreturn-local-addr warning
authorArnd Bergmann <arnd@arndb.de>
Thu, 30 Apr 2020 10:39:02 +0000 (12:39 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 May 2020 18:47:52 +0000 (11:47 -0700)
commit071a43e660996d1517d02ea7724491cc5b93bb03
tree4d368d2129fe75ef4f44c8823befe3ad95040be8
parentc649c41d5d0f7d153bd5d5d9c093fec16ee03e00
cxgb4/chcr: avoid -Wreturn-local-addr warning

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: 5a4b9fe7fece ("cxgb4/chcr: complete record tx handling")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/crypto/chelsio/chcr_ktls.c