* Re: [net-next v1] pfcp: avoid copy warning by simplifing code [not found] <20240404135721.647474-1-michal.swiatkowski@linux.intel.com> @ 2024-04-04 13:59 ` Michal Swiatkowski 2024-04-04 14:22 ` Arnd Bergmann 2024-04-04 14:59 ` Jakub Kicinski 0 siblings, 2 replies; 4+ messages in thread From: Michal Swiatkowski @ 2024-04-04 13:59 UTC (permalink / raw) To: davem, edumazet, kuba, pabeni Cc: netdev, aleksander.lobakin, nex.sw.ncis.osdt.itp.upstreaming, Arnd Bergmann On Thu, Apr 04, 2024 at 03:57:21PM +0200, Michal Swiatkowski wrote: > From Arnd comment: > "The memcpy() in the ip_tunnel_info_opts_set() causes > a string.h fortification warning, with at least gcc-13: > > In function 'fortify_memcpy_chk', > inlined from 'ip_tunnel_info_opts_set' at include/net/ip_tunnels.h:619:3, > inlined from 'pfcp_encap_recv' at drivers/net/pfcp.c:84:2: > include/linux/fortify-string.h:553:25: 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] > 553 | __write_overflow_field(p_size_field, size);" > > It is a false-positivie caused by ambiguity of the union. > > However, as Arnd noticed, copying here is unescessary. The code can be > simplified to avoid calling ip_tunnel_info_opts_set(), which is doing > copying, setting flags and options_len. > > Set correct flags and options_len directly on tun_info. > > Reported-by: Arnd Bergmann <arnd@arndb.de> > Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> > --- > drivers/net/pfcp.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/pfcp.c b/drivers/net/pfcp.c > index cc5b28c5f99f..69434fd13f96 100644 > --- a/drivers/net/pfcp.c > +++ b/drivers/net/pfcp.c > @@ -80,9 +80,8 @@ static int pfcp_encap_recv(struct sock *sk, struct sk_buff *skb) > else > pfcp_node_recv(pfcp, skb, md); > > - __set_bit(IP_TUNNEL_PFCP_OPT_BIT, flags); > - ip_tunnel_info_opts_set(&tun_dst->u.tun_info, md, sizeof(*md), > - flags); > + __set_bit(IP_TUNNEL_PFCP_OPT_BIT, tun_dst->u.tun_info.key.tun_flags); > + tun_dst->u.tun_info.options_len = sizeof(*md); > > if (unlikely(iptunnel_pull_header(skb, PFCP_HLEN, skb->protocol, > !net_eq(sock_net(sk), > -- > 2.42.0 > Ehh, sorry, misstype in netdev ccing CC: netdev@vger.kernel.org ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [net-next v1] pfcp: avoid copy warning by simplifing code 2024-04-04 13:59 ` [net-next v1] pfcp: avoid copy warning by simplifing code Michal Swiatkowski @ 2024-04-04 14:22 ` Arnd Bergmann 2024-04-04 14:59 ` Jakub Kicinski 1 sibling, 0 replies; 4+ messages in thread From: Arnd Bergmann @ 2024-04-04 14:22 UTC (permalink / raw) To: Michal Swiatkowski, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni Cc: Netdev, Alexander Lobakin, nex.sw.ncis.osdt.itp.upstreaming On Thu, Apr 4, 2024, at 15:59, Michal Swiatkowski wrote: > On Thu, Apr 04, 2024 at 03:57:21PM +0200, Michal Swiatkowski wrote: >> pfcp_node_recv(pfcp, skb, md); >> >> - __set_bit(IP_TUNNEL_PFCP_OPT_BIT, flags); >> - ip_tunnel_info_opts_set(&tun_dst->u.tun_info, md, sizeof(*md), >> - flags); >> + __set_bit(IP_TUNNEL_PFCP_OPT_BIT, tun_dst->u.tun_info.key.tun_flags); >> + tun_dst->u.tun_info.options_len = sizeof(*md); >> >> if (unlikely(iptunnel_pull_header(skb, PFCP_HLEN, skb->protocol, >> !net_eq(sock_net(sk), Looks good to me, Acked-by: Arnd Bergmann <arnd@arndb.de> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [net-next v1] pfcp: avoid copy warning by simplifing code 2024-04-04 13:59 ` [net-next v1] pfcp: avoid copy warning by simplifing code Michal Swiatkowski 2024-04-04 14:22 ` Arnd Bergmann @ 2024-04-04 14:59 ` Jakub Kicinski 2024-04-04 16:21 ` Alexander Lobakin 1 sibling, 1 reply; 4+ messages in thread From: Jakub Kicinski @ 2024-04-04 14:59 UTC (permalink / raw) To: Michal Swiatkowski Cc: davem, edumazet, pabeni, netdev, aleksander.lobakin, nex.sw.ncis.osdt.itp.upstreaming, Arnd Bergmann On Thu, 4 Apr 2024 15:59:12 +0200 Michal Swiatkowski wrote: > Ehh, sorry, misstype in netdev ccing > CC: netdev@vger.kernel.org You gotta resend, feel free to do so right away, just keep Arnd's ack. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [net-next v1] pfcp: avoid copy warning by simplifing code 2024-04-04 14:59 ` Jakub Kicinski @ 2024-04-04 16:21 ` Alexander Lobakin 0 siblings, 0 replies; 4+ messages in thread From: Alexander Lobakin @ 2024-04-04 16:21 UTC (permalink / raw) To: Michal Swiatkowski Cc: Jakub Kicinski, davem, edumazet, pabeni, netdev, nex.sw.ncis.osdt.itp.upstreaming, Arnd Bergmann From: Jakub Kicinski <kuba@kernel.org> Date: Thu, 4 Apr 2024 07:59:24 -0700 > On Thu, 4 Apr 2024 15:59:12 +0200 Michal Swiatkowski wrote: >> Ehh, sorry, misstype in netdev ccing >> CC: netdev@vger.kernel.org > > You gotta resend, feel free to do so right away, just keep Arnd's ack. Also pls include "Fixes:" tag at the top and "Closes:" with the link to the original report right after Reported-by (see `checkpatch --strict` output). Thanks, Olek ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-04 16:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20240404135721.647474-1-michal.swiatkowski@linux.intel.com>
2024-04-04 13:59 ` [net-next v1] pfcp: avoid copy warning by simplifing code Michal Swiatkowski
2024-04-04 14:22 ` Arnd Bergmann
2024-04-04 14:59 ` Jakub Kicinski
2024-04-04 16:21 ` Alexander Lobakin
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).