lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 21 Apr 2023 22:26:25 -0700
From:   "Tantilov, Emil S" <emil.s.tantilov@...el.com>
To:     Simon Horman <simon.horman@...igine.com>,
        Pavan Kumar Linga <pavan.kumar.linga@...el.com>
CC:     <willemb@...gle.com>, <pabeni@...hat.com>,
        <netdev@...r.kernel.org>, <jesse.brandeburg@...el.com>,
        <kuba@...nel.org>, <edumazet@...gle.com>,
        <anthony.l.nguyen@...el.com>, <intel-wired-lan@...ts.osuosl.org>,
        Phani Burra <phani.r.burra@...el.com>, <decot@...gle.com>,
        <davem@...emloft.net>
Subject: Re: [Intel-wired-lan] [PATCH net-next v2 14/15] idpf: add ethtool
 callbacks



On 4/13/2023 12:11 PM, Tantilov, Emil S wrote:
> 
> 
> On 4/11/2023 2:55 AM, Simon Horman wrote:
>> On Mon, Apr 10, 2023 at 06:13:53PM -0700, Pavan Kumar Linga wrote:
>>> From: Alan Brady <alan.brady@...el.com>
>>
>> ...
>>
>>> diff --git a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c 
>>> b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
>>
>> ...
>>
>>> +/**
>>> + * idpf_add_qstat_strings - Copy queue stat strings into ethtool buffer
>>> + * @p: ethtool supplied buffer
>>> + * @stats: stat definitions array
>>> + * @type: stat type
>>> + * @idx: stat idx
>>> + *
>>> + * Format and copy the strings described by the const static stats 
>>> value into
>>> + * the buffer pointed at by p.
>>> + *
>>> + * The parameter @stats is evaluated twice, so parameters with side 
>>> effects
>>> + * should be avoided. Additionally, stats must be an array such that
>>> + * ARRAY_SIZE can be called on it.
>>> + */
>>> +#define idpf_add_qstat_strings(p, stats, type, idx) \
>>> +    __idpf_add_qstat_strings(p, stats, ARRAY_SIZE(stats), type, idx)
>>
>> Hi Pavan, Hi Alan,
>>
>> FWIIW, I think __idpf_add_qstat_strings() could be a function.
>> It would give some type checking. And avoid possible aliasing of inputs.
>> Basically, I think functions should be used unless there is a reason 
>> not to.
>>
>> ...
> 
> Good catch, we'll resolve it in v3.

The reason a macro is used in this case is that it allows 
__idpf_add_qstat_strings() to get the size of the arrays passed by the 
caller. Is there a way to do this if we convert the macro to a function?

Thanks,
Emil

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ