Unverified Commit 32c824e0 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15654 media: pvrusb2: fix array-index-out-of-bounds in pvr2_i2c_core_init

parents f8a4bcc6 e2498602
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -2561,6 +2561,11 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
	} while (0);
	mutex_unlock(&pvr2_unit_mtx);

	INIT_WORK(&hdw->workpoll, pvr2_hdw_worker_poll);

	if (hdw->unit_number == -1)
		goto fail;

	cnt1 = 0;
	cnt2 = scnprintf(hdw->name+cnt1,sizeof(hdw->name)-cnt1,"pvrusb2");
	cnt1 += cnt2;
@@ -2572,8 +2577,6 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
	if (cnt1 >= sizeof(hdw->name)) cnt1 = sizeof(hdw->name)-1;
	hdw->name[cnt1] = 0;

	INIT_WORK(&hdw->workpoll,pvr2_hdw_worker_poll);

	pvr2_trace(PVR2_TRACE_INIT,"Driver unit number is %d, name is %s",
		   hdw->unit_number,hdw->name);