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

Commit e8755fbb authored by Mohammed Javid's avatar Mohammed Javid Committed by Swetha Chikkaboraiah
Browse files

msm: ipa: Fix pointer checked for NULL may be used



Data pointer may be NULL, check for reset value
to be false in that case and return EINVAL for
invalid argument.

Change-Id: I05a4aa96724c123516a7965bd0e939bdf0c86553
Signed-off-by: default avatarMohammed Javid <mjavid@codeaurora.org>
parent 1bccccb4
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2014-2018, 2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2018, 2020-2021, The Linux Foundation. All rights reserved.
 */

/*
@@ -2837,6 +2837,15 @@ static int rmnet_ipa_query_tethering_stats_modem(
	struct ipa_get_data_stats_resp_msg_v01 *resp;
	int pipe_len, rc;

	if (data != NULL) {
		/* prevent string buffer overflows */
		data->upstreamIface[IFNAMSIZ-1] = '\0';
		data->tetherIface[IFNAMSIZ-1] = '\0';
	} else if (reset) {
		/* Data can be NULL for reset stats, checking reset != False */
		return -EINVAL;
	}

	req = kzalloc(sizeof(struct ipa_get_data_stats_req_msg_v01),
			GFP_KERNEL);
	if (!req) {
+10 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
 */

/*
@@ -3268,6 +3268,15 @@ static int rmnet_ipa3_query_tethering_stats_modem(
	int pipe_len, rc;
	struct ipa_pipe_stats_info_type_v01 *stat_ptr;

	if (data != NULL) {
		/* prevent string buffer overflows */
		data->upstreamIface[IFNAMSIZ-1] = '\0';
		data->tetherIface[IFNAMSIZ-1] = '\0';
	} else if (reset) {
		/* Data can be NULL for reset stats, checking reset != False */
		return -EINVAL;
	}

	req = kzalloc(sizeof(struct ipa_get_data_stats_req_msg_v01),
			GFP_KERNEL);
	if (!req)