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

Commit e2432c40 authored by Saket Saurabh's avatar Saket Saurabh
Browse files

u_rmnet_ctrl_qti: Add correct check for validating the port number



This change adds correct check for validating the port number to
be used. The max value of port number defined is NR_QTI_PORTS.
So the permitted range of port number to be used is from zero
to (NR_QTI_PORTS-1). Any value of port number outside this range
(i.e. value greater than and equal to NR_QTI_PORTS) is to be marked
as invalid port.

CRs-Fixed: 562195
Change-Id: I655956fda7071c84a15c3f3d1f637aa6120ff645
Signed-off-by: default avatarSaket Saurabh <ssaurabh@codeaurora.org>
parent 61a09d4a
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ static int grmnet_ctrl_qti_send_cpkt_tomodem(u8 portno,
		return -EINVAL;
	}

	if (portno > NR_QTI_PORTS) {
	if (portno >= NR_QTI_PORTS) {
		pr_err("%s: Invalid QTI port %d\n", __func__, portno);
		return -ENODEV;
	}
@@ -140,7 +140,7 @@ gqti_ctrl_notify_modem(void *gptr, u8 portno, int val)
{
	struct rmnet_ctrl_qti_port *port;

	if (portno > NR_QTI_PORTS) {
	if (portno >= NR_QTI_PORTS) {
		pr_err("%s: Invalid QTI port %d\n", __func__, portno);
		return;
	}
@@ -158,7 +158,7 @@ int gqti_ctrl_connect(struct grmnet *gr, u8 port_num)
	unsigned long		flags;

	pr_debug("%s: grmnet:%p\n", __func__, gr);
	if (port_num > NR_QTI_PORTS) {
	if (port_num >= NR_QTI_PORTS) {
		pr_err("%s: Invalid QTI port %d\n", __func__, port_num);
		return -ENODEV;
	}
@@ -169,7 +169,7 @@ int gqti_ctrl_connect(struct grmnet *gr, u8 port_num)
		return -ENODEV;
	}

	if (port_num > NR_QTI_PORTS) {
	if (port_num >= NR_QTI_PORTS) {
		pr_err("%s: Invalid QTI port %d\n", __func__, port_num);
		return -ENODEV;
	}
@@ -203,7 +203,7 @@ void gqti_ctrl_disconnect(struct grmnet *gr, u8 port_num)
		return;
	}

	if (port_num > NR_QTI_PORTS) {
	if (port_num >= NR_QTI_PORTS) {
		pr_err("%s: Invalid QTI port %d\n", __func__, port_num);
		return;
	}