Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30dadc31 authored by Maya Erez's avatar Maya Erez
Browse files

usb: gadget: Validate the port number in grmnet_ctrl_smd_port_alloc



Fix code quality issues found by the automatic checking tool.
Verify that port number is within the max port limit before setting it
in grmnet_ctrl_smd_port_alloc.

CRs-Fixed: 566927
Change-Id: Iecc50a98c4e32bd8800ea63de0ccb8aecda78090
Signed-off-by: default avatarDanny Segal <dsegal@codeaurora.org>
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
parent c5b954d0
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -592,6 +592,11 @@ static int grmnet_ctrl_smd_port_alloc(int portno)
	struct smd_ch_info	*c;
	struct platform_driver	*pdrv;

	if (portno >= MAX_CTRL_PORT) {
		pr_err("Illegal port number.\n");
		return -EINVAL;
	}

	port = kzalloc(sizeof(struct rmnet_ctrl_port), GFP_KERNEL);
	if (!port)
		return -ENOMEM;