From: Jakub Kicinski <kuba@kernel.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: "Łukasz Stelmach" <l.stelmach@samsung.com>, netdev@vger.kernel.org
Subject: Re: [PATCH] net: asix: fix fortify warning
Date: Fri, 8 Dec 2023 16:07:55 -0800 [thread overview]
Message-ID: <20231208160755.4271a283@kernel.org> (raw)
In-Reply-To: <20231206133822.620802-1-dmantipov@yandex.ru>
On Wed, 6 Dec 2023 16:38:04 +0300 Dmitry Antipov wrote:
> When compiling with gcc version 14.0.0 20231129 (experimental) and
> CONFIG_FORTIFY_SOURCE=y, I've noticed the following warning:
>
> ...
> In function 'fortify_memcpy_chk',
> inlined from 'ax88796c_tx_fixup' at drivers/net/ethernet/asix/ax88796c_main.c:287:2:
> ./include/linux/fortify-string.h:588:25: warning: call to '__read_overflow2_field'
> declared with attribute warning: detected read beyond size of field (2nd parameter);
> maybe use struct_group()? [-Wattribute-warning]
> 588 | __read_overflow2_field(q_size_field, size);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ...
>
> This call to 'memcpy()' is interpreted as an attempt to copy TX_OVERHEAD
> (which is 8) bytes from 4-byte 'sop' field of 'struct tx_pkt_info' and
> thus overread warning is issued. Since we actually wants to copy both
> 'sop' and 'seg' fields at once, use the convenient 'struct_group()' here.
Can we change the definition of TX_OVERHEAD to be
sizeof_field(... tx_overhead), to make it clear that
the two are indeed identical?
next prev parent reply other threads:[~2023-12-09 0:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-06 13:38 [PATCH] net: asix: fix fortify warning Dmitry Antipov
2023-12-09 0:07 ` Jakub Kicinski [this message]
2023-12-11 9:05 ` [PATCH] [v2] " Dmitry Antipov
[not found] ` <CGME20231212093305eucas1p1efe0774516346de77142dc1ab427122d@eucas1p1.samsung.com>
2023-12-12 9:33 ` Lukasz Stelmach
2023-12-12 22:10 ` patchwork-bot+netdevbpf
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=20231208160755.4271a283@kernel.org \
--to=kuba@kernel.org \
--cc=dmantipov@yandex.ru \
--cc=l.stelmach@samsung.com \
--cc=netdev@vger.kernel.org \
/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).