public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Tom Rix <trix@redhat.com>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org,
	nathan@kernel.org, ndesaulniers@google.com
Cc: linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	Tom Rix <trix@redhat.com>
Subject: [PATCH] tty: n_gsm: return -EINVAL when adaption is not supported
Date: Tue, 26 Apr 2022 08:05:54 -0400	[thread overview]
Message-ID: <20220426120554.1120585-1-trix@redhat.com> (raw)

The clang build fails with
n_gsm.c:940:13: error: variable 'size' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
        } else if (dlci->adaption == 2) {
                   ^~~~~~~~~~~~~~~~~~~

The else should return an error, so return -EINVAL.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/tty/n_gsm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index b0762d2fa8d6..3b8c65f66d64 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -944,6 +944,7 @@ static int gsm_dlci_modem_output(struct gsm_mux *gsm, struct gsm_dlci *dlci,
 	} else {
 		pr_err("%s: unsupported adaption %d\n", __func__,
 		       dlci->adaption);
+		return -EINVAL;
 	}
 
 	msg = gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype);
-- 
2.27.0


             reply	other threads:[~2022-04-26 12:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-26 12:05 Tom Rix [this message]
2022-04-26 12:12 ` [PATCH] tty: n_gsm: return -EINVAL when adaption is not supported Greg KH
2022-04-26 18:16   ` Tom Rix
2022-04-26 18:37     ` Greg KH

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=20220426120554.1120585-1-trix@redhat.com \
    --to=trix@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox