hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/media/usb/dvb-usb/az6027.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* DVB USB compliant Linux driver for the AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)
23 * receiver.
34 *
45 * Copyright (C) 2009 Adams.Xu <adams.xu@azwave.com.cn>
56 *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of the GNU General Public License as published by the Free
8
- * Software Foundation, version 2.
9
- *
10
- * see Documentation/media/dvb-drivers/dvb-usb.rst for more information
7
+ * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
118 */
129 #include "az6027.h"
1310
....@@ -978,6 +975,10 @@
978975 if (msg[i].addr == 0x99) {
979976 req = 0xBE;
980977 index = 0;
978
+ if (msg[i].len < 1) {
979
+ i = -EOPNOTSUPP;
980
+ break;
981
+ }
981982 value = msg[i].buf[0] & 0x00ff;
982983 length = 1;
983984 az6027_usb_out_op(d, req, value, index, data, length);
....@@ -987,6 +988,10 @@
987988 /* write/read request */
988989 if (i + 1 < num && (msg[i + 1].flags & I2C_M_RD)) {
989990 req = 0xB9;
991
+ if (msg[i].len < 1) {
992
+ i = -EOPNOTSUPP;
993
+ break;
994
+ }
990995 index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff));
991996 value = msg[i].addr + (msg[i].len << 8);
992997 length = msg[i + 1].len + 6;
....@@ -1000,6 +1005,10 @@
10001005
10011006 /* demod 16bit addr */
10021007 req = 0xBD;
1008
+ if (msg[i].len < 1) {
1009
+ i = -EOPNOTSUPP;
1010
+ break;
1011
+ }
10031012 index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff));
10041013 value = msg[i].addr + (2 << 8);
10051014 length = msg[i].len - 2;
....@@ -1025,6 +1034,10 @@
10251034 } else {
10261035
10271036 req = 0xBD;
1037
+ if (msg[i].len < 1) {
1038
+ i = -EOPNOTSUPP;
1039
+ break;
1040
+ }
10281041 index = msg[i].buf[0] & 0x00FF;
10291042 value = msg[i].addr + (1 << 8);
10301043 length = msg[i].len - 1;
....@@ -1055,8 +1068,8 @@
10551068 };
10561069
10571070 static int az6027_identify_state(struct usb_device *udev,
1058
- struct dvb_usb_device_properties *props,
1059
- struct dvb_usb_device_description **desc,
1071
+ const struct dvb_usb_device_properties *props,
1072
+ const struct dvb_usb_device_description **desc,
10601073 int *cold)
10611074 {
10621075 u8 *b;