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: <20240928151358.220e3edf@jic23-huawei>
Date: Sat, 28 Sep 2024 15:13:58 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: kernel test robot <lkp@...el.com>
Cc: Mariel Tinaco <Mariel.Tinaco@...log.com>, linux-iio@...r.kernel.org,
 devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, Lars-Peter
 Clausen <lars@...afoo.de>, Rob Herring <robh@...nel.org>, Krzysztof
 Kozlowski <krzk@...nel.org>, Michael Hennerich
 <Michael.Hennerich@...log.com>, Conor Dooley <conor+dt@...nel.org>, Marcelo
 Schmitt <marcelo.schmitt1@...il.com>, Dimitri Fedrau
 <dima.fedrau@...il.com>, David Lechner <dlechner@...libre.com>, Nuno
 Sá <noname.nuno@...il.com>, oe-kbuild-all@...ts.linux.dev
Subject: Re: [PATCH v4 2/2] iio: dac: support the ad8460 Waveform DAC

On Sat, 21 Sep 2024 09:11:12 +0800
kernel test robot <lkp@...el.com> wrote:

> Hi Mariel,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on fec496684388685647652ab4213454fbabdab099]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Mariel-Tinaco/dt-bindings-iio-dac-add-docs-for-ad8460/20240912-175718
> base:   fec496684388685647652ab4213454fbabdab099
> patch link:    https://lore.kernel.org/r/20240912095435.18639-3-Mariel.Tinaco%40analog.com
> patch subject: [PATCH v4 2/2] iio: dac: support the ad8460 Waveform DAC
> config: sparc-randconfig-r071-20240921 (https://download.01.org/0day-ci/archive/20240921/202409210849.cRodncgA-lkp@intel.com/config)
> compiler: sparc64-linux-gcc (GCC) 14.1.0
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@...el.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202409210849.cRodncgA-lkp@intel.com/
> 
> smatch warnings:
> drivers/iio/dac/ad8460.c:545 ad8460_write_event_value() warn: unsigned 'fault' is never less than zero.
> drivers/iio/dac/ad8460.c:545 ad8460_write_event_value() warn: error code type promoted to positive: 'fault'
> drivers/iio/dac/ad8460.c:567 ad8460_read_event_value() warn: unsigned 'fault' is never less than zero.
> drivers/iio/dac/ad8460.c:567 ad8460_read_event_value() warn: error code type promoted to positive: 'fault'
> drivers/iio/dac/ad8460.c:585 ad8460_write_event_config() warn: unsigned 'fault' is never less than zero.
> drivers/iio/dac/ad8460.c:585 ad8460_write_event_config() warn: error code type promoted to positive: 'fault'
> drivers/iio/dac/ad8460.c:605 ad8460_read_event_config() warn: unsigned 'fault' is never less than zero.
> drivers/iio/dac/ad8460.c:605 ad8460_read_event_config() warn: error code type promoted to positive: 'fault'
> 
> vim +/fault +545 drivers/iio/dac/ad8460.c
> 
>    528	
>    529	static int ad8460_write_event_value(struct iio_dev *indio_dev,
>    530					    const struct iio_chan_spec *chan,
>    531					    enum iio_event_type type,
>    532					    enum iio_event_direction dir,
>    533					    enum iio_event_info info, int val, int val2)
>    534	{
>    535		struct ad8460_state *state = iio_priv(indio_dev);
>    536		unsigned int fault;
I fixed this up by making all the local fault variables int instead.

Jonathan

>    537	
>    538		if (type != IIO_EV_TYPE_THRESH)
>    539			return -EINVAL;
>    540	
>    541		if (info != IIO_EV_INFO_VALUE)
>    542			return -EINVAL;
>    543	
>    544		fault = ad8460_select_fault_type(chan->type, dir);
>  > 545		if (fault < 0)  
>    546			return fault;
>    547	
>    548		return ad8460_set_fault_threshold(state, fault, val);
>    549	}
>    550	
>    551	static int ad8460_read_event_value(struct iio_dev *indio_dev,
>    552					   const struct iio_chan_spec *chan,
>    553					   enum iio_event_type type,
>    554					   enum iio_event_direction dir,
>    555					   enum iio_event_info info, int *val, int *val2)
>    556	{
>    557		struct ad8460_state *state = iio_priv(indio_dev);
>    558		unsigned int fault;
>    559	
>    560		if (type != IIO_EV_TYPE_THRESH)
>    561			return -EINVAL;
>    562	
>    563		if (info != IIO_EV_INFO_VALUE)
>    564			return -EINVAL;
>    565	
>    566		fault = ad8460_select_fault_type(chan->type, dir);
>  > 567		if (fault < 0)  
>    568			return fault;
>    569	
>    570		return ad8460_get_fault_threshold(state, fault, val);
>    571	}
>    572	
>    573	static int ad8460_write_event_config(struct iio_dev *indio_dev,
>    574					     const struct iio_chan_spec *chan,
>    575					     enum iio_event_type type,
>    576					     enum iio_event_direction dir, int val)
>    577	{
>    578		struct ad8460_state *state = iio_priv(indio_dev);
>    579		unsigned int fault;
>    580	
>    581		if (type != IIO_EV_TYPE_THRESH)
>    582			return -EINVAL;
>    583	
>    584		fault = ad8460_select_fault_type(chan->type, dir);
>  > 585		if (fault < 0)  
>    586			return fault;
>    587	
>    588		return ad8460_set_fault_threshold_en(state, fault, val);
>    589	}
>    590	
>    591	static int ad8460_read_event_config(struct iio_dev *indio_dev,
>    592					    const struct iio_chan_spec *chan,
>    593					    enum iio_event_type type,
>    594					    enum iio_event_direction dir)
>    595	{
>    596		struct ad8460_state *state = iio_priv(indio_dev);
>    597		unsigned int fault;
>    598		bool en;
>    599		int ret;
>    600	
>    601		if (type != IIO_EV_TYPE_THRESH)
>    602			return -EINVAL;
>    603	
>    604		fault = ad8460_select_fault_type(chan->type, dir);
>  > 605		if (fault < 0)  
>    606			return fault;
>    607	
>    608		ret = ad8460_get_fault_threshold_en(state, fault, &en);
>    609		if (ret)
>    610			return ret;
>    611	
>    612		return en;
>    613	}
>    614	
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ