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: <20240416170742.4ebbb130@kernel.org>
Date: Tue, 16 Apr 2024 17:07:42 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Rahul Rameshbabu <rrameshbabu@...dia.com>
Cc: netdev@...r.kernel.org, Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
 Jacob Keller <jacob.e.keller@...el.com>, Paolo Abeni <pabeni@...hat.com>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet
 <edumazet@...gle.com>, Gal Pressman <gal@...dia.com>, Tariq Toukan
 <tariqt@...dia.com>, Saeed Mahameed <saeedm@...dia.com>, Carolina Jubran
 <cjubran@...dia.com>, Cosmin Ratiu <cratiu@...dia.com>, Michal Kubecek
 <mkubecek@...e.cz>
Subject: Re: [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics
 support

On Tue, 16 Apr 2024 13:37:17 -0700 Rahul Rameshbabu wrote:
> +		if (mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U32)) {
> +			is_u64 = true;
> +			if (mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U64)) {
> +				fprintf(stderr, "malformed netlink message (statistic)\n");
> +				goto err_close_stats;
> +			}
> +		}

possibly cleaner:

	__u64 val;

	if (!mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U32)) {
		val = mnl_attr_get_u32(tb[stats[i].attr]);
	} else if (!mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U64)) {
		val = mnl_attr_get_u64(tb[stats[i].attr]);
	} else {
		fprintf(stderr, "malformed netlink message (statistic)\n");
		goto err_close_stats;
	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ