All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Johan Hovold <johan@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] USB: serial: ir-usb: Silence harmless uninitialized variable warning
Date: Thu, 30 Jan 2020 10:12:47 +0000	[thread overview]
Message-ID: <20200130101247.GB8871@localhost> (raw)
In-Reply-To: <20200129173037.cvrb3lcddsml54h5@kili.mountain>

On Wed, Jan 29, 2020 at 08:30:37PM +0300, Dan Carpenter wrote:
> The "actual_length" variable might be uninitialized on some failure
> paths.  It's harmless but static analysis tools like Smatch complain
> and at runtime the UBSan tool will likely complain as well.
> 
> Fixes: e7542bc382f8 ("USB: serial: ir-usb: make set_termios synchronous")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Nice catch, I'll queue this up for 5.6-rc.

> ---
>  drivers/usb/serial/ir-usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
> index 79d0586e2b33..172261a908d8 100644
> --- a/drivers/usb/serial/ir-usb.c
> +++ b/drivers/usb/serial/ir-usb.c
> @@ -448,7 +448,7 @@ static void ir_set_termios(struct tty_struct *tty,
>  			usb_sndbulkpipe(udev, port->bulk_out_endpointAddress),
>  			transfer_buffer, 1, &actual_length, 5000);
>  	if (ret || actual_length != 1) {
> -		if (actual_length != 1)
> +		if (!ret)
>  			ret = -EIO;
>  		dev_err(&port->dev, "failed to change line speed: %d\n", ret);
>  	}

Johan

WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Johan Hovold <johan@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] USB: serial: ir-usb: Silence harmless uninitialized variable warning
Date: Thu, 30 Jan 2020 11:12:47 +0100	[thread overview]
Message-ID: <20200130101247.GB8871@localhost> (raw)
In-Reply-To: <20200129173037.cvrb3lcddsml54h5@kili.mountain>

On Wed, Jan 29, 2020 at 08:30:37PM +0300, Dan Carpenter wrote:
> The "actual_length" variable might be uninitialized on some failure
> paths.  It's harmless but static analysis tools like Smatch complain
> and at runtime the UBSan tool will likely complain as well.
> 
> Fixes: e7542bc382f8 ("USB: serial: ir-usb: make set_termios synchronous")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Nice catch, I'll queue this up for 5.6-rc.

> ---
>  drivers/usb/serial/ir-usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
> index 79d0586e2b33..172261a908d8 100644
> --- a/drivers/usb/serial/ir-usb.c
> +++ b/drivers/usb/serial/ir-usb.c
> @@ -448,7 +448,7 @@ static void ir_set_termios(struct tty_struct *tty,
>  			usb_sndbulkpipe(udev, port->bulk_out_endpointAddress),
>  			transfer_buffer, 1, &actual_length, 5000);
>  	if (ret || actual_length != 1) {
> -		if (actual_length != 1)
> +		if (!ret)
>  			ret = -EIO;
>  		dev_err(&port->dev, "failed to change line speed: %d\n", ret);
>  	}

Johan

  reply	other threads:[~2020-01-30 10:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 17:30 [PATCH] USB: serial: ir-usb: Silence harmless uninitialized variable warning Dan Carpenter
2020-01-29 17:30 ` Dan Carpenter
2020-01-30 10:12 ` Johan Hovold [this message]
2020-01-30 10:12   ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200130101247.GB8871@localhost \
    --to=johan@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.