]> git.baikalelectronics.ru Git - kernel.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)
commitfd7ffb2f4b2556b5688f48534dcd1be7c4756851
tree4d368d2129fe75ef4f44c8823befe3ad95040be8
parent246adaa0e1cc19850274577f24bc41276be2715d
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: 06759b817af5 ("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