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]
Date:	Mon, 2 Mar 2009 14:36:04 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Mike Rapoport <mike@...pulab.co.il>
Cc:	alessandro.zummo@...ertech.it, rtc-linux@...glegroups.com,
	linux-kernel@...r.kernel.org, raph@...com, mike@...pulab.co.il,
	David Brownell <david-b@...bell.net>
Subject: Re: [PATCH] rtc-v3020: add ability to access v3020 chip with GPIOs

On Mon,  2 Mar 2009 13:40:57 +0200
Mike Rapoport <mike@...pulab.co.il> wrote:

> +static int v3020_gpio_map(struct v3020 *chip, struct platform_device *pdev,
> +			  struct v3020_platform_data *pdata)
> +{
> +	int i, err;
> +
> +	v3020_gpio[V3020_CS].gpio = pdata->gpio_cs;
> +	v3020_gpio[V3020_WR].gpio = pdata->gpio_wr;
> +	v3020_gpio[V3020_RD].gpio = pdata->gpio_rd;
> +	v3020_gpio[V3020_IO].gpio = pdata->gpio_io;
> +
> +	for (i = 0; i < ARRAY_SIZE(v3020_gpio); i++) {
> +		err = gpio_request(v3020_gpio[i].gpio, v3020_gpio[i].name);
> +		if (err)
> +			goto err_request;
> +
> +		gpio_direction_output(v3020_gpio[i].gpio, 1);
> +	}
> +
> +	chip->gpio = v3020_gpio;
> +
> +	return 0;
> +
> +err_request:
> +	for (; i >= 0; i--)
> +		gpio_free(v3020_gpio[i].gpio);
> +
> +	return err;
> +}

It needs this fix, I think?


fix off-by-one in error path

--- a/drivers/rtc/rtc-v3020.c~rtc-v3020-add-ability-to-access-v3020-chip-with-gpios-fix
+++ a/drivers/rtc/rtc-v3020.c
@@ -136,7 +136,7 @@ static int v3020_gpio_map(struct v3020 *
 	return 0;
 
 err_request:
-	for (; i >= 0; i--)
+	while (--i >= 0)
 		gpio_free(v3020_gpio[i].gpio);
 
 	return err;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ