From: David Miller <davem@davemloft.net>
To: arnd@arndb.de
Cc: ayush.sawal@chelsio.com, vinay.yadav@chelsio.com,
rohitm@chelsio.com, herbert@gondor.apana.org.au,
netdev@vger.kernel.org, yuehaibing@huawei.com,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cxgb4/chcr: avoid -Wreturn-local-addr warning
Date: Mon, 04 May 2020 11:48:06 -0700 (PDT) [thread overview]
Message-ID: <20200504.114806.529418018451997120.davem@davemloft.net> (raw)
In-Reply-To: <20200430103912.1170231-1-arnd@arndb.de>
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.
prev parent reply other threads:[~2020-05-04 18:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 10:39 [PATCH] cxgb4/chcr: avoid -Wreturn-local-addr warning Arnd Bergmann
2020-05-04 18:48 ` David Miller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200504.114806.529418018451997120.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=arnd@arndb.de \
--cc=ayush.sawal@chelsio.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rohitm@chelsio.com \
--cc=vinay.yadav@chelsio.com \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).