[media] cec: fix off-by-one memset
authorHans Verkuil <hverkuil@xs4all.nl>
Fri, 22 Jul 2016 08:36:29 +0000 (05:36 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 28 Jul 2016 23:16:35 +0000 (20:16 -0300)
The unused bytes of the features array should be zeroed, but the start index was one
byte too early. This caused the device features byte to be overwritten by 0.

The compliance test for the CEC_S_LOG_ADDRS ioctl didn't catch this because it tested
byte continuation with the second device features byte being 0 :-(

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/staging/media/cec/cec-adap.c

index 9fffddb7ac7e9b8f6d780c171de7155aa47745df..b2393bbacb261551f16ecd2efd44cbfe18220fdd 100644 (file)
@@ -1252,7 +1252,7 @@ int __cec_s_log_addrs(struct cec_adapter *adap,
                        return -EINVAL;
                }
                /* Zero unused part of the feature array */
-               memset(features + i, 0, feature_sz - i);
+               memset(features + i + 1, 0, feature_sz - i - 1);
        }
 
        if (log_addrs->cec_version >= CEC_OP_CEC_VERSION_2_0) {
This page took 0.026365 seconds and 5 git commands to generate.