[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 3/7] net/eth: Make ip6_ext_hdr *ext_hdr pointer to const
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v5 3/7] net/eth: Make ip6_ext_hdr *ext_hdr pointer to const |
Date: |
Wed, 10 Mar 2021 18:25:15 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
On 3/10/21 5:46 PM, Stefano Garzarella wrote:
> On Wed, Mar 10, 2021 at 05:01:31PM +0100, Philippe Mathieu-Daudé wrote:
>> As the callee doesn't need to modify the ext_hdr buffer,
>> mark it const.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> net/eth.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/eth.c b/net/eth.c
>> index 6a5a1d04e0b..7c47a267a7a 100644
>> --- a/net/eth.c
>> +++ b/net/eth.c
>> @@ -402,7 +402,7 @@ eth_is_ip6_extension_header_type(uint8_t hdr_type)
>> static bool
>> _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags,
>> size_t ext_hdr_offset,
>> - struct ip6_ext_hdr *ext_hdr,
>> + const struct ip6_ext_hdr *ext_hdr,
>> struct in6_address *dst_addr)
>> {
>> struct ip6_ext_hdr_routing *rthdr = (struct ip6_ext_hdr_routing *)
>> ext_hdr;
>> --
>> 2.26.2
>>
>
> This patch is fine, but after the last patch of this series, 'ext_hdr'
> is not used anymore, so what about removing this parameter?
Clever :)
- [PATCH v5 0/7] net/eth: Fix stack-buffer-overflow in _eth_get_rss_ex_dst_addr(), Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v5 1/7] net/eth: Simplify _eth_get_rss_ex_dst_addr(), Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v5 2/7] net/eth: Better describe _eth_get_rss_ex_dst_addr's offset argument, Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v5 4/7] net/eth: Check the size earlier, Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v5 3/7] net/eth: Make ip6_ext_hdr *ext_hdr pointer to const, Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v5 5/7] net/eth: Check iovec has enough data earlier, Philippe Mathieu-Daudé, 2021/03/10
[PATCH v5 7/7] net/eth: Add an assert() and invert if() statement to simplify code, Philippe Mathieu-Daudé, 2021/03/10
[PATCH v5 6/7] net/eth: Read ip6_ext_hdr_routing buffer before accessing it, Philippe Mathieu-Daudé, 2021/03/10