| .. | .. |
|---|
| 128 | 128 | |
|---|
| 129 | 129 | switch (num) { |
|---|
| 130 | 130 | case 2: |
|---|
| 131 | + if (msg[0].len < 1) { |
|---|
| 132 | + num = -EOPNOTSUPP; |
|---|
| 133 | + break; |
|---|
| 134 | + } |
|---|
| 131 | 135 | /* read stv0299 register */ |
|---|
| 132 | 136 | value = msg[0].buf[0];/* register */ |
|---|
| 133 | 137 | for (i = 0; i < msg[1].len; i++) { |
|---|
| .. | .. |
|---|
| 139 | 143 | case 1: |
|---|
| 140 | 144 | switch (msg[0].addr) { |
|---|
| 141 | 145 | case 0x68: |
|---|
| 146 | + if (msg[0].len < 2) { |
|---|
| 147 | + num = -EOPNOTSUPP; |
|---|
| 148 | + break; |
|---|
| 149 | + } |
|---|
| 142 | 150 | /* write to stv0299 register */ |
|---|
| 143 | 151 | buf6[0] = 0x2a; |
|---|
| 144 | 152 | buf6[1] = msg[0].buf[0]; |
|---|
| .. | .. |
|---|
| 148 | 156 | break; |
|---|
| 149 | 157 | case 0x60: |
|---|
| 150 | 158 | if (msg[0].flags == 0) { |
|---|
| 159 | + if (msg[0].len < 4) { |
|---|
| 160 | + num = -EOPNOTSUPP; |
|---|
| 161 | + break; |
|---|
| 162 | + } |
|---|
| 151 | 163 | /* write to tuner pll */ |
|---|
| 152 | 164 | buf6[0] = 0x2c; |
|---|
| 153 | 165 | buf6[1] = 5; |
|---|
| .. | .. |
|---|
| 159 | 171 | dw210x_op_rw(d->udev, 0xb2, 0, 0, |
|---|
| 160 | 172 | buf6, 7, DW210X_WRITE_MSG); |
|---|
| 161 | 173 | } else { |
|---|
| 174 | + if (msg[0].len < 1) { |
|---|
| 175 | + num = -EOPNOTSUPP; |
|---|
| 176 | + break; |
|---|
| 177 | + } |
|---|
| 162 | 178 | /* read from tuner */ |
|---|
| 163 | 179 | dw210x_op_rw(d->udev, 0xb5, 0, 0, |
|---|
| 164 | 180 | buf6, 1, DW210X_READ_MSG); |
|---|
| .. | .. |
|---|
| 166 | 182 | } |
|---|
| 167 | 183 | break; |
|---|
| 168 | 184 | case (DW2102_RC_QUERY): |
|---|
| 185 | + if (msg[0].len < 2) { |
|---|
| 186 | + num = -EOPNOTSUPP; |
|---|
| 187 | + break; |
|---|
| 188 | + } |
|---|
| 169 | 189 | dw210x_op_rw(d->udev, 0xb8, 0, 0, |
|---|
| 170 | 190 | buf6, 2, DW210X_READ_MSG); |
|---|
| 171 | 191 | msg[0].buf[0] = buf6[0]; |
|---|
| 172 | 192 | msg[0].buf[1] = buf6[1]; |
|---|
| 173 | 193 | break; |
|---|
| 174 | 194 | case (DW2102_VOLTAGE_CTRL): |
|---|
| 195 | + if (msg[0].len < 1) { |
|---|
| 196 | + num = -EOPNOTSUPP; |
|---|
| 197 | + break; |
|---|
| 198 | + } |
|---|
| 175 | 199 | buf6[0] = 0x30; |
|---|
| 176 | 200 | buf6[1] = msg[0].buf[0]; |
|---|
| 177 | 201 | dw210x_op_rw(d->udev, 0xb2, 0, 0, |
|---|
| .. | .. |
|---|
| 946 | 970 | for (i = 0; i < 6; i++) { |
|---|
| 947 | 971 | obuf[1] = 0xf0 + i; |
|---|
| 948 | 972 | if (i2c_transfer(&d->i2c_adap, msg, 2) != 2) |
|---|
| 949 | | - break; |
|---|
| 973 | + return -1; |
|---|
| 950 | 974 | else |
|---|
| 951 | 975 | mac[i] = ibuf[0]; |
|---|
| 952 | 976 | } |
|---|