]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: cec: fix smatch error
authorHans Verkuil <hverkuil@xs4all.nl>
Sat, 7 Apr 2018 09:38:52 +0000 (05:38 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Aug 2018 05:48:01 +0000 (07:48 +0200)
[ Upstream commit b66d448487a478c203368f2b72d7d9156a01f6be ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/cec/cec-pin-error-inj.c

index 1e644a8c1a778f7f051426c5f00ad1dba8992da9..c0088d3b8e3d9594febe98bfaf00506586e6bb53 100644 (file)
@@ -204,16 +204,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;