hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/media/usb/dvb-usb-v2/ec168.c
....@@ -115,6 +115,10 @@
115115 while (i < num) {
116116 if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) {
117117 if (msg[i].addr == ec168_ec100_config.demod_address) {
118
+ if (msg[i].len < 1) {
119
+ i = -EOPNOTSUPP;
120
+ break;
121
+ }
118122 req.cmd = READ_DEMOD;
119123 req.value = 0;
120124 req.index = 0xff00 + msg[i].buf[0]; /* reg */
....@@ -131,6 +135,10 @@
131135 }
132136 } else {
133137 if (msg[i].addr == ec168_ec100_config.demod_address) {
138
+ if (msg[i].len < 1) {
139
+ i = -EOPNOTSUPP;
140
+ break;
141
+ }
134142 req.cmd = WRITE_DEMOD;
135143 req.value = msg[i].buf[1]; /* val */
136144 req.index = 0xff00 + msg[i].buf[0]; /* reg */
....@@ -139,6 +147,10 @@
139147 ret = ec168_ctrl_msg(d, &req);
140148 i += 1;
141149 } else {
150
+ if (msg[i].len < 1) {
151
+ i = -EOPNOTSUPP;
152
+ break;
153
+ }
142154 req.cmd = WRITE_I2C;
143155 req.value = msg[i].buf[0]; /* val */
144156 req.index = 0x0100 + msg[i].addr; /* I2C addr */