Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1277152

Re: [PATCH] serial: ifx6x60: avoid uninitialized variable use

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH] serial: ifx6x60: avoid uninitialized variable use
Date 2015-11-25 11:10 +0100
Message-ID <qyFbs-4Ly-27@gated-at.bofh.it> (permalink)
References <qytWF-5Av-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tuesday 24 November 2015 23:04:00 Arnd Bergmann wrote:
> gcc warns about a potential use of an uninitialized variable in this driver:
> 
> drivers/tty/serial/ifx6x60.c: In function 'ifx_spi_complete':
> drivers/tty/serial/ifx6x60.c:713:6: warning: 'more' may be used uninitialized in this function [-Wmaybe-uninitialized]
>    if (more || ifx_dev->spi_more || queue_length > 0 ||
> 
> Unlike a lot of other such warnings, this one is correct and describes
> an actual problem in the handling of the "IFX_SPI_HEADER_F" result code.
> 
> This appears to be a result from a restructuring of the driver that
> dates back to before it was merged in the kernel, so it's impossible
> to know where it went wrong. I also don't know what that result code
> means, so I have no idea if setting 'more' to zero is the correct
> solution, but at least it makes the behavior reproducible rather than
> depending on whatever happens to be on the kernel stack.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> Cc everyone who contributed non-cleanup patches to this driver,
> maybe someone has more insight into the operation of the driver than
> I have and can comment on whether this is the right fix or not.

Grmbl. Please don't apply this version for now.

The patch fixes one issue and made the warning go away in some
configurations, but my randconfig tests still show the same warning
in other configurations, as there is a second way that the 'more'
variable ends up being referenced without being initialized.

Let's wait for comments first, but I assume we will have to initialize
the 'more' variable as well, or possibly that function needs to
be rewritten.

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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] serial: ifx6x60: avoid uninitialized variable use Arnd Bergmann <arnd@arndb.de> - 2015-11-24 23:10 +0100
  Re: [PATCH] serial: ifx6x60: avoid uninitialized variable use Arnd Bergmann <arnd@arndb.de> - 2015-11-25 11:10 +0100

csiph-web