[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <058f6e5d-369e-48c7-a5ea-976eccccaafe@intel.com>
Date: Wed, 20 Mar 2024 11:10:09 +0100
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Kees Cook <keescook@...omium.org>, Simon Horman <horms@...nel.org>
CC: <linux-hardening@...r.kernel.org>, "Gustavo A. R. Silva"
<gustavoars@...nel.org>, Marco Elver <elver@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFC kspp-next 3/3] idpf: sprinkle __counted_by{,_le}() in
the virtchnl2 header
From: Kees Cook <keescook@...omium.org>
Date: Tue, 19 Mar 2024 14:42:56 -0700
> On Tue, Mar 19, 2024 at 06:57:18PM +0000, Simon Horman wrote:
>> On Mon, Mar 18, 2024 at 02:03:54PM +0100, Alexander Lobakin wrote:
>>> Both virtchnl2.h and its consumer idpf_virtchnl.c are very error-prone.
>>> There are 10 structures with flexible arrays at the end, but 9 of them
>>> has flex member counter in Little Endian.
>>> Make the code a bit more robust by applying __counted_by_le() to those
>>> 9. LE platforms is the main target for this driver, so they would
>>> receive additional protection.
>>> While we're here, add __counted_by() to virtchnl2_ptype::proto_id, as
>>> its counter is `u8` regardless of the Endianness.
>>> Compile test on x86_64 (LE) didn't reveal any new issues after applying
>>> the attributes.
>>>
>>> Signed-off-by: Alexander Lobakin <aleksander.lobakin@...el.com>
>>
>> Hi Alexander,
>>
>> with this patch applied ./scripts/kernel-doc -none reports the following.
>> I think that this means that the kernel-doc needs to be taught
>> about __counted_by_le (and __counted_by_be).
>
> Oh, yes, I should have remembered that need. Sorry! It should be
> addressed by adding them where __counted_by is already listed in
> Documentation/conf.py.
Oh, thanks to both of you! I'll do that before sending v1.
>
> -Kees
>
>>
>> .../virtchnl2.h:559: warning: Excess struct member 'chunks' description in 'virtchnl2_queue_reg_chunks'
>> .../virtchnl2.h:707: warning: Excess struct member 'qinfo' description in 'virtchnl2_config_tx_queues'
>> .../virtchnl2.h:786: warning: Excess struct member 'qinfo' description in 'virtchnl2_config_rx_queues'
>> .../virtchnl2.h:872: warning: Excess struct member 'vchunks' description in 'virtchnl2_vector_chunks'
>> .../virtchnl2.h:916: warning: Excess struct member 'lut' description in 'virtchnl2_rss_lut'
>> .../virtchnl2.h:1108: warning: Excess struct member 'key_flex' description in 'virtchnl2_rss_key'
>> .../virtchnl2.h:1199: warning: Excess struct member 'qv_maps' description in 'virtchnl2_queue_vector_maps'
>> .../virtchnl2.h:1251: warning: Excess struct member 'mac_addr_list' description in 'virtchnl2_mac_addr_list'
>>
>> ...
>
Thanks,
Olek
Powered by blists - more mailing lists