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] [day] [month] [year] [list]
Message-ID: <20170730145719.GA24243@kroah.com>
Date:   Sun, 30 Jul 2017 07:57:19 -0700
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Elia Geretto <elia.f.geretto@...il.com>
Cc:     devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: pi433: Use matching enum types calling
 rf69_set_packet_format

On Sat, Jul 29, 2017 at 11:29:13AM +0200, Elia Geretto wrote:
> This patch fixes the following four warnings found using sparse:
> 
> drivers/staging/pi433/pi433_if.c:211:9: warning: mixing different enum types
> drivers/staging/pi433/pi433_if.c:211:9:     int enum optionOnOff  versus
> drivers/staging/pi433/pi433_if.c:211:9:     int enum packetFormat
> drivers/staging/pi433/pi433_if.c:211:9: warning: mixing different enum types
> drivers/staging/pi433/pi433_if.c:211:9:     int enum optionOnOff  versus
> drivers/staging/pi433/pi433_if.c:211:9:     int enum packetFormat
> drivers/staging/pi433/pi433_if.c:268:9: warning: mixing different enum types
> drivers/staging/pi433/pi433_if.c:268:9:     int enum optionOnOff  versus
> drivers/staging/pi433/pi433_if.c:268:9:     int enum packetFormat
> drivers/staging/pi433/pi433_if.c:268:9: warning: mixing different enum types
> drivers/staging/pi433/pi433_if.c:268:9:     int enum optionOnOff  versus
> drivers/staging/pi433/pi433_if.c:268:9:     int enum packetFormat
> 
> This is done calling the rf69_set_packet_format function using the
> appropriate enum for the packetFormat argument.
> 
> Signed-off-by: Elia Geretto <elia.f.geretto@...il.com>
> ---
>  drivers/staging/pi433/pi433_if.c | 24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
> index d9328ce5ec1d..fc2250810eed 100644
> --- a/drivers/staging/pi433/pi433_if.c
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -208,7 +208,17 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg)
>  	{
>  		SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, always));
>  	}
> -	SET_CHECKED(rf69_set_packet_format  (dev->spi, rx_cfg->enable_length_byte));
> +	if (rx_cfg->enable_length_byte == optionOn) {
> +		int ret = rf69_set_packet_format(dev->spi, packetLengthVar);

Declare ret at the top of the function please, that will save you 2
extra blank lines (and more in the future as the horrid SET_CHECKED()
macro gets removed...)

> +
> +		if (ret < 0)
> +			return ret;
> +	} else {
> +		int ret = rf69_set_packet_format(dev->spi, packetLengthFix);
> +
> +		if (ret < 0)
> +			return ret;
> +	}
>  	SET_CHECKED(rf69_set_adressFiltering(dev->spi, rx_cfg->enable_address_filtering));
>  	SET_CHECKED(rf69_set_crc_enable	    (dev->spi, rx_cfg->enable_crc));
>  
> @@ -264,8 +274,18 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg)
>  	{
>  		SET_CHECKED(rf69_set_preamble_length(dev->spi, 0));
>  	}
> +	if (tx_cfg->enable_length_byte == optionOn) {
> +		int ret = rf69_set_packet_format(dev->spi, packetLengthVar);

Same here.

> +
> +		if (ret < 0)
> +			return ret;
> +	} else {
> +		int ret = rf69_set_packet_format(dev->spi, packetLengthFix);
> +
> +		if (ret < 0)
> +			return ret;
> +	}
>  	SET_CHECKED(rf69_set_sync_enable  (dev->spi, tx_cfg->enable_sync));
> -	SET_CHECKED(rf69_set_packet_format(dev->spi, tx_cfg->enable_length_byte));

Why move the location of the check?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ