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]
Message-ID: <43b722cd-f449-4910-8a15-1fcc096f19bc@redhat.com>
Date: Thu, 25 Apr 2024 10:09:17 +0200
From: Adrian Moreno <amorenoz@...hat.com>
To: Ido Schimmel <idosch@...sch.org>
Cc: netdev@...r.kernel.org, aconole@...hat.com, echaudro@...hat.com,
 horms@...nel.org, i.maximets@....org, Yotam Gigi <yotam.gi@...il.com>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 3/8] net: psample: add user cookie



On 4/25/24 09:32, Ido Schimmel wrote:
> On Wed, Apr 24, 2024 at 03:50:50PM +0200, Adrian Moreno wrote:
>> @@ -579,6 +580,15 @@ void psample_sample_packet(struct psample_group *group, struct sk_buff *skb,
>>   			goto error;
>>   	}
>>   #endif
>> +	if (md->user_cookie && md->user_cookie_len) {
>> +		int nla_len = nla_total_size(md->user_cookie_len);
>> +		struct nlattr *nla;
>> +
>> +		nla = skb_put(nl_skb, nla_len);
>> +		nla->nla_type = PSAMPLE_ATTR_USER_COOKIE;
>> +		nla->nla_len = nla_attr_size(md->user_cookie_len);
>> +		memcpy(nla_data(nla), md->user_cookie, md->user_cookie_len);
>> +	}
> 
> Did you consider using nla_put() instead?
> 

That's way simpler, thanks. I'll update it and send another version.


> diff --git a/net/psample/psample.c b/net/psample/psample.c
> index 92db8ffa2ba2..ea59ca46b119 100644
> --- a/net/psample/psample.c
> +++ b/net/psample/psample.c
> @@ -589,15 +589,10 @@ void psample_sample_packet(struct psample_group *group, struct sk_buff *skb,
>                          goto error;
>          }
>   #endif
> -       if (md->user_cookie && md->user_cookie_len) {
> -               int nla_len = nla_total_size(md->user_cookie_len);
> -               struct nlattr *nla;
> -
> -               nla = skb_put(nl_skb, nla_len);
> -               nla->nla_type = PSAMPLE_ATTR_USER_COOKIE;
> -               nla->nla_len = nla_attr_size(md->user_cookie_len);
> -               memcpy(nla_data(nla), md->user_cookie, md->user_cookie_len);
> -       }
> +       if (md->user_cookie && md->user_cookie_len &&
> +           nla_put(nl_skb, PSAMPLE_ATTR_USER_COOKIE, md->user_cookie_len,
> +                   md->user_cookie))
> +               goto error;
>   
>          genlmsg_end(nl_skb, data);
>          psample_nl_obj_desc_init(&desc, group->group_num);
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ