| .. | .. |
|---|
| 975 | 975 | if (msg[i].addr == 0x99) { |
|---|
| 976 | 976 | req = 0xBE; |
|---|
| 977 | 977 | index = 0; |
|---|
| 978 | + if (msg[i].len < 1) { |
|---|
| 979 | + i = -EOPNOTSUPP; |
|---|
| 980 | + break; |
|---|
| 981 | + } |
|---|
| 978 | 982 | value = msg[i].buf[0] & 0x00ff; |
|---|
| 979 | 983 | length = 1; |
|---|
| 980 | 984 | az6027_usb_out_op(d, req, value, index, data, length); |
|---|
| .. | .. |
|---|
| 984 | 988 | /* write/read request */ |
|---|
| 985 | 989 | if (i + 1 < num && (msg[i + 1].flags & I2C_M_RD)) { |
|---|
| 986 | 990 | req = 0xB9; |
|---|
| 991 | + if (msg[i].len < 1) { |
|---|
| 992 | + i = -EOPNOTSUPP; |
|---|
| 993 | + break; |
|---|
| 994 | + } |
|---|
| 987 | 995 | index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff)); |
|---|
| 988 | 996 | value = msg[i].addr + (msg[i].len << 8); |
|---|
| 989 | 997 | length = msg[i + 1].len + 6; |
|---|
| .. | .. |
|---|
| 997 | 1005 | |
|---|
| 998 | 1006 | /* demod 16bit addr */ |
|---|
| 999 | 1007 | req = 0xBD; |
|---|
| 1008 | + if (msg[i].len < 1) { |
|---|
| 1009 | + i = -EOPNOTSUPP; |
|---|
| 1010 | + break; |
|---|
| 1011 | + } |
|---|
| 1000 | 1012 | index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff)); |
|---|
| 1001 | 1013 | value = msg[i].addr + (2 << 8); |
|---|
| 1002 | 1014 | length = msg[i].len - 2; |
|---|
| .. | .. |
|---|
| 1022 | 1034 | } else { |
|---|
| 1023 | 1035 | |
|---|
| 1024 | 1036 | req = 0xBD; |
|---|
| 1037 | + if (msg[i].len < 1) { |
|---|
| 1038 | + i = -EOPNOTSUPP; |
|---|
| 1039 | + break; |
|---|
| 1040 | + } |
|---|
| 1025 | 1041 | index = msg[i].buf[0] & 0x00FF; |
|---|
| 1026 | 1042 | value = msg[i].addr + (1 << 8); |
|---|
| 1027 | 1043 | length = msg[i].len - 1; |
|---|