Re: [PATCHv2 net] bonding: fix ICMPv6 header handling when receiving IPv6 messages

Hangbin Liu
2022-11-09T02:23:43Z

On Wed, Nov 09, 2022 at 12:06:32AM +0800, kernel test robot wrote:
> All warnings (new ones prefixed by >>):
>
> drivers/net/bonding/bond_main.c: In function 'bond_na_rcv':
> >> drivers/net/bonding/bond_main.c:3242:77: warning: passing argument 4 of 'skb_header_pointer' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
> 3242 | hdr = skb_header_pointer(skb, sizeof(struct ipv6hdr), sizeof(_hdr), &_hdr);
> | ^~~~~

Oh...When I post patches, I always rebuild the whole kernel. Maybe I missed
this warning as the build info passed to fast. I will only build the module
like the bot did in future...

I have post a new version to fix this.

> from drivers/net/bonding/bond_main.c:35:
> In function 'fortify_memcpy_chk',
> inlined from 'iph_to_flow_copy_v4addrs' at include/net/ip.h:566:2,
> inlined from 'bond_flow_ip' at drivers/net/bonding/bond_main.c:3983:3:
> include/linux/fortify-string.h:413: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]
> 413 | __read_overflow2_field(q_size_field, size);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In function 'fortify_memcpy_chk',
> inlined from 'iph_to_flow_copy_v6addrs' at include/net/ipv6.h:900:2,
> inlined from 'bond_flow_ip' at drivers/net/bonding/bond_main.c:3993:3:
> include/linux/fortify-string.h:413: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]
> 413 | __read_overflow2_field(q_size_field, size);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I will post another patch to fix this warning.

Thanks
Hangbin