diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2018-04-07 05:38:52 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-04-17 05:49:59 -0400 |
commit | b66d448487a478c203368f2b72d7d9156a01f6be (patch) | |
tree | daa7beb652666cf1a3724c4c6f667f54ece9ec5e | |
parent | 9879c9d3ecb45379adf180a28a7cea19cdca07bd (diff) | |
download | op-kernel-dev-b66d448487a478c203368f2b72d7d9156a01f6be.zip op-kernel-dev-b66d448487a478c203368f2b72d7d9156a01f6be.tar.gz |
media: cec: fix smatch error
drivers/media/cec/cec-pin-error-inj.c:231
cec_pin_error_inj_parse_line() error: uninitialized symbol 'pos'.
The tx-add-bytes command didn't check for the presence of an argument, and
also didn't check that it was > 0.
This should fix this error.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/cec/cec-pin-error-inj.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/media/cec/cec-pin-error-inj.c b/drivers/media/cec/cec-pin-error-inj.c index aaa899a..7132a27 100644 --- a/drivers/media/cec/cec-pin-error-inj.c +++ b/drivers/media/cec/cec-pin-error-inj.c @@ -203,16 +203,18 @@ bool cec_pin_error_inj_parse_line(struct cec_adapter *adap, char *line) mode_mask = CEC_ERROR_INJ_MODE_MASK << mode_offset; arg_idx = cec_error_inj_cmds[i].arg_idx; - if (mode_offset == CEC_ERROR_INJ_RX_ARB_LOST_OFFSET || - mode_offset == CEC_ERROR_INJ_TX_ADD_BYTES_OFFSET) - is_bit_pos = false; - if (mode_offset == CEC_ERROR_INJ_RX_ARB_LOST_OFFSET) { if (has_op) return false; if (!has_pos) pos = 0x0f; + is_bit_pos = false; + } else if (mode_offset == CEC_ERROR_INJ_TX_ADD_BYTES_OFFSET) { + if (!has_pos || !pos) + return false; + is_bit_pos = false; } + if (arg_idx >= 0 && is_bit_pos) { if (!has_pos || pos >= 160) return false; |