tty: n_gsm: fix sometimes uninitialized warning in gsm_dlci_modem_output()
authorDaniel Starke <daniel.starke@siemens.com>
Mon, 25 Apr 2022 10:47:26 +0000 (03:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jul 2022 14:35:06 +0000 (16:35 +0200)
commite58094e2b51699fe1046104f4d2425afc7b31053
treedb26406a9da70ea33f3baff464c5304b22ad243b
parentb952aa508786ab4b7328972482f40905af856246
tty: n_gsm: fix sometimes uninitialized warning in gsm_dlci_modem_output()

[ Upstream commit 19317433057dc1f2ca9a975e4e6b547282c2a5ef ]

'size' may be used uninitialized in gsm_dlci_modem_output() if called with
an adaption that is neither 1 nor 2. The function is currently only called
by gsm_modem_upd_via_data() and only for adaption 2.
Properly handle every invalid case by returning -EINVAL to silence the
compiler warning and avoid future regressions.

Fixes: c19ffe00fed6 ("tty: n_gsm: fix invalid use of MSC in advanced option")
Cc: stable@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Daniel Starke <daniel.starke@siemens.com>
Link: https://lore.kernel.org/r/20220425104726.7986-1-daniel.starke@siemens.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/n_gsm.c