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: <20190919140025.GC22556@lunn.ch>
Date:   Thu, 19 Sep 2019 16:00:25 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Alexandru Ardelean <alexandru.ardelean@...log.com>
Cc:     netdev@...r.kernel.org, linville@...driver.com,
        f.fainelli@...il.com
Subject: Re: [PATCH 2/2][ethtool] ethtool: implement support for Energy
 Detect Power Down

> -static int parse_named_u8(struct cmd_context *ctx, const char *name, u8 *val)
> +static int parse_named_uint(struct cmd_context *ctx, const char *name,
> +			    void *val, enum tunable_type_id type_id)
>  {
>  	if (ctx->argc < 2)
>  		return 0;
> @@ -5026,7 +5051,16 @@ static int parse_named_u8(struct cmd_context *ctx, const char *name, u8 *val)
>  	if (strcmp(*ctx->argp, name))
>  		return 0;
>  
> -	*val = get_uint_range(*(ctx->argp + 1), 0, 0xff);
> +	switch (type_id) {
> +	case ETHTOOL_TUNABLE_U8:
> +		*(u8 *)val = get_uint_range(*(ctx->argp + 1), 0, 0xff);
> +		break;
> +	case ETHTOOL_TUNABLE_U16:
> +		*(u16 *)val = get_uint_range(*(ctx->argp + 1), 0, 0xffff);

I personally don't like these casts. Could you refactor this code in
some other way to avoid them. Make the parse_named_u8()
parse_named_u16() a bit fatter, and the shared code a bit slimmer?

Thanks
	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ