lkml.org 
[lkml]   [2020]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] cxgb4/chcr: avoid -Wreturn-local-addr warning
From
From: Arnd Bergmann <arnd@arndb.de>
Date: Thu, 30 Apr 2020 12:39:02 +0200

> 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>

Applied, thanks Arnd.

\
 
 \ /
  Last update: 2020-05-04 20:48    [W:0.049 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site