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: <20200811015659.GB25507@sol>
Date:   Tue, 11 Aug 2020 09:56:59 +0800
From:   Kent Gibson <warthog618@...il.com>
To:     linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
        bgolaszewski@...libre.com, linus.walleij@...aro.org
Subject: Re: [PATCH v3 05/18] gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL
 and GPIO_V2_LINE_GET_VALUES_IOCTL

On Sun, Aug 09, 2020 at 09:25:16PM +0800, Kent Gibson wrote:
> Add support for requesting lines using the GPIO_V2_GET_LINE_IOCTL, and
> returning their current values using GPIO_V2_LINE_GET_VALUES_IOCTL.
> 
> Signed-off-by: Kent Gibson <warthog618@...il.com>
> ---
> 
[snip]

> +static long line_get_values(struct line *line, void __user *ip)
> +{
> +	struct gpio_v2_line_values lv;
> +	DECLARE_BITMAP(vals, GPIO_V2_LINES_MAX);
> +	DECLARE_BITMAP(mask, GPIO_V2_LINES_MAX);
> +	struct gpio_desc **descs;
> +	int ret, i, didx, num_get = 0;
> +
> +	/* NOTE: It's ok to read values of output lines. */
> +	if (copy_from_user(&lv, ip, sizeof(lv)))
> +		return -EFAULT;
> +
> +	if (lv.mask == 0)
> +		return -EINVAL;
> +
> +	bitmap_from_u64(mask, lv.mask);
> +	num_get = bitmap_weight(mask, line->num_descs);

Nuts, that doesn't do what I intend, and is part of a failed experiment
that I thought I had reverted.

Assume that in the next version the mask handling will be similar to
line_set_values_locked in patch 09.

i.e. 
	for (i = 0; i < line->num_descs; i++)
		if (lv.mask & BIT_ULL(i))
			num_get++;

and the subsequent mask tests will be against lv.mask instead of the
mask bitmap declared above (which will be gone).

I won't do a v4 just yet though - there is sure to be other things
to go in there.

Cheers,
Kent.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ