Merge "qcacmn: Correct tx_encap_type check"

This commit is contained in:
Linux Build Service Account 2019-07-04 07:05:33 -07:00 • committed by Gerrit - the friendly Code Review server
commit da3a277778
3 changed files with 69 additions and 3 deletions

View file

@ -1881,8 +1881,9 @@ static bool dp_check_exc_metadata(struct cdp_tx_exception_metadata *tx_exc)
{
bool invalid_tid = (tx_exc->tid > DP_MAX_TIDS && tx_exc->tid !=
HTT_INVALID_TID);
bool invalid_encap_type = (tx_exc->tid > DP_MAX_TIDS && tx_exc->tid !=
HTT_INVALID_TID);
bool invalid_encap_type =
(tx_exc->tx_encap_type > htt_cmn_pkt_num_types &&
tx_exc->tx_encap_type != CDP_INVALID_TX_ENCAP_TYPE);
bool invalid_sec_type = (tx_exc->sec_type > cdp_num_sec_types &&
tx_exc->sec_type != CDP_INVALID_SEC_TYPE);
bool invalid_cookie = (tx_exc->is_tx_sniffer == 1 &&

View file

@ -934,6 +934,22 @@ struct qdf_ipv6_addr {
*/
QDF_STATUS qdf_ipv6_parse(const char *ipv6_str, struct qdf_ipv6_addr *out_addr);
/**
* qdf_uint16_array_parse() - parse the given string as uint16 array
* @in_str: the input string to parse
* @out_array: the output uint16 array, populated on success
* @array_size: size of the array
* @out_size: size of the populated array
*
* This API is called to convert string (each value separated by
* a comma) into an uint16 array
*
* Return: QDF_STATUS
*/
QDF_STATUS qdf_uint16_array_parse(const char *in_str, uint16_t *out_array,
qdf_size_t array_size, qdf_size_t *out_size);
/**
* qdf_uint8_array_parse() - parse the given string as uint8 array
* @in_str: the input string to parse

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -612,6 +612,55 @@ QDF_STATUS qdf_ipv6_parse(const char *ipv6_str, struct qdf_ipv6_addr *out_addr)
}
qdf_export_symbol(qdf_ipv6_parse);
QDF_STATUS qdf_uint16_array_parse(const char *in_str, uint16_t *out_array,
qdf_size_t array_size, qdf_size_t *out_size)
{
QDF_STATUS status;
bool negate;
qdf_size_t size = 0;
uint64_t value;
QDF_BUG(in_str);
if (!in_str)
return QDF_STATUS_E_INVAL;
QDF_BUG(out_array);
if (!out_array)
return QDF_STATUS_E_INVAL;
QDF_BUG(out_size);
if (!out_size)
return QDF_STATUS_E_INVAL;
while (size < array_size) {
status = __qdf_int_parse_lazy(&in_str, &value, &negate);
if (QDF_IS_STATUS_ERROR(status))
return status;
if ((uint16_t)value != value || negate)
return QDF_STATUS_E_RANGE;
in_str = qdf_str_left_trim(in_str);
switch (in_str[0]) {
case ',':
out_array[size++] = value;
in_str++;
break;
case '\0':
out_array[size++] = value;
*out_size = size;
return QDF_STATUS_SUCCESS;
default:
return QDF_STATUS_E_FAILURE;
}
}
return QDF_STATUS_E_FAILURE;
}
qdf_export_symbol(qdf_uint16_array_parse);
QDF_STATUS qdf_uint8_array_parse(const char *in_str, uint8_t *out_array,
qdf_size_t array_size, qdf_size_t *out_size)
{