From: Herbert Xu <herbert@gondor.apana.org.au>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Giovanni Cabiddu <giovanni.cabiddu@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Damian Muszynski <damian.muszynski@intel.com>,
Arnd Bergmann <arnd@arndb.de>,
Tom Zanussi <tom.zanussi@linux.intel.com>,
Jie Wang <jie.wang@intel.com>,
qat-linux@intel.com, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: qat - avoid memcpy() overflow warning
Date: Fri, 26 Jan 2024 16:58:46 +0800 [thread overview]
Message-ID: <ZbN0RkMLJ2NBKQ5v@gondor.apana.org.au> (raw)
In-Reply-To: <20240103162608.987145-1-arnd@kernel.org>
On Wed, Jan 03, 2024 at 05:26:02PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The use of array_size() leads gcc to assume the memcpy() can have a larger
> limit than actually possible, which triggers a string fortification warning:
>
> In file included from include/linux/string.h:296,
> from include/linux/bitmap.h:12,
> from include/linux/cpumask.h:12,
> from include/linux/sched.h:16,
> from include/linux/delay.h:23,
> from include/linux/iopoll.h:12,
> from drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c:3:
> In function 'fortify_memcpy_chk',
> inlined from 'adf_gen4_init_thd2arb_map' at drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c:401:3:
> include/linux/fortify-string.h:579:4: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
> 579 | __write_overflow_field(p_size_field, size);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/fortify-string.h:588:4: error: call to '__read_overflow2_field' declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror=attribute-warning]
> 588 | __read_overflow2_field(q_size_field, size);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Add an explicit range check to avoid this.
>
> Fixes: 5da6a2d5353e ("crypto: qat - generate dynamically arbiter mappings")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c | 3 +++
> 1 file changed, 3 insertions(+)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2024-01-26 8:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-03 16:26 [PATCH] crypto: qat - avoid memcpy() overflow warning Arnd Bergmann
2024-01-03 17:07 ` Cabiddu, Giovanni
2024-01-26 8:58 ` Herbert Xu [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=ZbN0RkMLJ2NBKQ5v@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=damian.muszynski@intel.com \
--cc=davem@davemloft.net \
--cc=giovanni.cabiddu@intel.com \
--cc=jie.wang@intel.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qat-linux@intel.com \
--cc=tom.zanussi@linux.intel.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