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: <8047ae8d-e2c0-4818-942d-2581ab56ad6d@6wind.com>
Date: Tue, 27 Feb 2024 12:05:31 +0100
From: Nicolas Dichtel <nicolas.dichtel@...nd.com>
To: Jakub Kicinski <kuba@...nel.org>, davem@...emloft.net
Cc: netdev@...r.kernel.org, edumazet@...gle.com, pabeni@...hat.com,
 donald.hunter@...il.com, jiri@...nulli.us, sdf@...gle.com
Subject: Re: [PATCH net-next v2 02/15] tools: ynl: create local attribute
 helpers

Le 26/02/2024 à 22:20, Jakub Kicinski a écrit :
> Don't use mnl attr helpers, we're trying to remove the libmnl
> dependency. Create both signed and unsigned helpers, libmnl
> had unsigned helpers, so code generator no longer needs
> the mnl_type() hack.
> 
> The new helpers are written from first principles, but are
> hopefully not too buggy.
> 
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> --
> v2:
>  - NLA_ALIGN(sizeof(struct nlattr)) -> NLA_HDRLEN;
>  - ...put_strz() -> ...put_str()
>  - use ynl_attr_data() in ynl_attr_get_{str,s8,u8}()
[snip]
> +static inline __s8 ynl_attr_get_s8(const struct nlattr *attr)
> +{
> +	return *(__s8 *)ynl_attr_data(attr);
> +}
> +
> +static inline __s16 ynl_attr_get_s16(const struct nlattr *attr)
> +{
> +	__s16 tmp;
> +
> +	memcpy(&tmp, (unsigned char *)(attr + 1), sizeof(tmp));
The same would work here, am I wrong?
return *(__s16 *)ynl_attr_data(attr);

Same for all kind of int.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ