Skip to contentSkip to conversation

tty: n_gsm: return -EINVAL when adaption is not supported

PATCH In review Tom Rix 2 participants 4 messages Apr 26, 2022 TTY layer and serial drivers

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 tty: n_gsm: return -EINVAL when adaption is not supported

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.

---
 drivers/tty/n_gsm.c | 1 +
 1 file changed, 1 insertion(+)
drivers/tty/n_gsm.c +1 -0
index b0762d2fa8d6..3b8c65f66d64 100644
@@ -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);
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 8 lines · Tom Rix

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.

What commit id does this fix? Any reason you didn't cc: the author of the recent changes to this code?

Is this the same issue that 0-day reported?

thanks,

greg k-h

author
#2 lore raw
Quoted 11 lines · Greg KH
Quoted 8 lines · Tom Rix

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.

What commit id does this fix? Any reason you didn't cc: the author of the recent changes to this code?

Sorry missed this part.

Quoted 1 line

Is this the same issue that 0-day reported?

Maybe, it was part of next's update today.  Where is 0-day reported ?

Tom

Quoted 5 lines

thanks,

greg k-h

maintainer
#3 lore raw
Quoted 8 lines · Tom Rix
Quoted 6 lines · Greg KH
Quoted 5 lines · Tom Rix

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) {
                    ^~~~~~~~~~~~~~~~~~~
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

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

What commit id does this fix? Any reason you didn't cc: the author of the recent changes to this code?

Sorry missed this part.

Please always do that, otherwise it's hard to track, right?

Quoted 3 lines
Quoted 1 line

Is this the same issue that 0-day reported?

Maybe, it was part of next's update today.  Where is 0-day reported ?

On the same mailing list you posted this patch to:

	https://lore.kernel.org/r/[email protected]

thanks,

greg k-h