We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a8acb4d commit d114b9fCopy full SHA for d114b9f
drivers/staging/ozwpan/ozusbsvc1.c
@@ -390,10 +390,15 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt)
390
case OZ_GET_DESC_RSP: {
391
struct oz_get_desc_rsp *body =
392
(struct oz_get_desc_rsp *)usb_hdr;
393
- int data_len = elt->length -
394
- sizeof(struct oz_get_desc_rsp) + 1;
395
- u16 offs = le16_to_cpu(get_unaligned(&body->offset));
396
- u16 total_size =
+ u16 offs, total_size;
+ u8 data_len;
+
+ if (elt->length < sizeof(struct oz_get_desc_rsp) - 1)
397
+ break;
398
+ data_len = elt->length -
399
+ (sizeof(struct oz_get_desc_rsp) - 1);
400
+ offs = le16_to_cpu(get_unaligned(&body->offset));
401
+ total_size =
402
le16_to_cpu(get_unaligned(&body->total_size));
403
oz_dbg(ON, "USB_REQ_GET_DESCRIPTOR - cnf\n");
404
oz_hcd_get_desc_cnf(usb_ctx->hport, body->req_id,
0 commit comments