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

Commit 40ce8b16 authored by Neil Leeder's avatar Neil Leeder Committed by Matt Wagantall
Browse files

qcom: cpaccess64: check for possible NULL from strsep



Handle the possibility that strsep could return a NULL
pointer, and don't try to dereference it.

Change-Id: I9b602e4cf359d9ba6663783ef61742d5e7846735
Signed-off-by: default avatarNeil Leeder <nleeder@codeaurora.org>
parent 67a06894
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
/* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -131,8 +131,13 @@ static int get_register_params(char *str_tmp)
	unsigned long op1, op2, crn, crm, op0, write_value;
	char rw;
	int cnt = 0;
	char *p;

	strlcpy(type, strsep(&str_tmp, ":"), TYPE_MAX_CHARACTERS);
	p = strsep(&str_tmp, ":");
	if (p == NULL)
		return -EINVAL;

	strlcpy(type, p, TYPE_MAX_CHARACTERS);
	if (strncasecmp(type, "S", TYPE_MAX_CHARACTERS) == 0) {

		sscanf(str_tmp, "%lu:%lu:%lu:%lu:%lu:%c:%lx:%d",