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:   Wed, 18 Jul 2018 13:18:34 +0200
From:   Lars-Peter Clausen <lars@...afoo.de>
To:     Manish Narani <manish.narani@...inx.com>, jic23@...nel.org,
        knaack.h@....de, pmeerw@...erw.net, michal.simek@...inx.com,
        linux-iio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Cc:     anirudh@...inx.com, sgoud@...inx.com, Joe Perches <joe@...ches.com>
Subject: Re: [PATCH 1/4] iio: adc: xilinx: Rename 'channels' variable name to
 'iio_xadc_channels'

On 07/18/2018 01:12 PM, Manish Narani wrote:
> This patch fix the following checkpatch warning in xadc driver.
> - Reusing the krealloc arg is almost always a bug.
> 
> Renamed the 'channels' variable as 'iio_xadc_channels' to fix the above
> warning.
> 

This is a bug in checkpatch and should be fixed in checkpatch. The code is
not actually re-using the parameter. channels and xadc_channels are
independent variables, just checkpatch somehow does not realize this.

> Signed-off-by: Manish Narani <manish.narani@...inx.com>
> ---
>  drivers/iio/adc/xilinx-xadc-core.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
> index d4f21d1..27b45df 100644
> --- a/drivers/iio/adc/xilinx-xadc-core.c
> +++ b/drivers/iio/adc/xilinx-xadc-core.c
> @@ -1040,7 +1040,7 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np,
>  	unsigned int *conf)
>  {
>  	struct xadc *xadc = iio_priv(indio_dev);
> -	struct iio_chan_spec *channels, *chan;
> +	struct iio_chan_spec *iio_xadc_channels, *chan;
>  	struct device_node *chan_node, *child;
>  	unsigned int num_channels;
>  	const char *external_mux;
> @@ -1083,12 +1083,13 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np,
>  		*conf |= XADC_CONF0_MUX | XADC_CONF0_CHAN(ext_mux_chan);
>  	}
>  
> -	channels = kmemdup(xadc_channels, sizeof(xadc_channels), GFP_KERNEL);
> -	if (!channels)
> +	iio_xadc_channels = kmemdup(xadc_channels, sizeof(xadc_channels),
> +				    GFP_KERNEL);
> +	if (!iio_xadc_channels)
>  		return -ENOMEM;
>  
>  	num_channels = 9;
> -	chan = &channels[9];
> +	chan = &iio_xadc_channels[9];
>  
>  	chan_node = of_get_child_by_name(np, "xlnx,channels");
>  	if (chan_node) {
> @@ -1119,11 +1120,12 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np,
>  	of_node_put(chan_node);
>  
>  	indio_dev->num_channels = num_channels;
> -	indio_dev->channels = krealloc(channels, sizeof(*channels) *
> -					num_channels, GFP_KERNEL);
> +	indio_dev->channels = krealloc(iio_xadc_channels,
> +				       sizeof(*iio_xadc_channels) *
> +				       num_channels, GFP_KERNEL);
>  	/* If we can't resize the channels array, just use the original */
>  	if (!indio_dev->channels)
> -		indio_dev->channels = channels;
> +		indio_dev->channels = iio_xadc_channels;
>  
>  	return 0;
>  }
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ