Merge "msm: ipa: Fix to unsigned integer underflow"

This commit is contained in:
Linux Build Service Account 2018-01-18 09:36:18 -08:00 committed by Gerrit - the friendly Code Review server
commit 13c7e628e7
2 changed files with 20 additions and 4 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, 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
@ -1446,7 +1446,11 @@ static ssize_t ipa_read_nat4(struct file *file,
pr_err("Table Size:%d\n",
ipa_ctx->nat_mem.size_base_tables);
pr_err("Expansion Table Size:%d\n",
if (!ipa_ctx->nat_mem.size_expansion_tables)
pr_err("Expansion Table Size:%d\n",
ipa_ctx->nat_mem.size_expansion_tables);
else
pr_err("Expansion Table Size:%d\n",
ipa_ctx->nat_mem.size_expansion_tables-1);
if (!ipa_ctx->nat_mem.is_sys_mem)
@ -1461,6 +1465,8 @@ static ssize_t ipa_read_nat4(struct file *file,
pr_err("\nBase Table:\n");
} else {
if (!ipa_ctx->nat_mem.size_expansion_tables)
continue;
tbl_size = ipa_ctx->nat_mem.size_expansion_tables-1;
base_tbl =
(u32 *)ipa_ctx->nat_mem.ipv4_expansion_rules_addr;
@ -1560,6 +1566,8 @@ static ssize_t ipa_read_nat4(struct file *file,
pr_err("\nIndex Table:\n");
} else {
if (!ipa_ctx->nat_mem.size_expansion_tables)
continue;
tbl_size = ipa_ctx->nat_mem.size_expansion_tables-1;
indx_tbl =
(u32 *)ipa_ctx->nat_mem.index_table_expansion_addr;

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, 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
@ -1509,7 +1509,11 @@ static ssize_t ipa3_read_nat4(struct file *file,
pr_err("Table Size:%d\n",
ipa3_ctx->nat_mem.size_base_tables);
pr_err("Expansion Table Size:%d\n",
if (!ipa3_ctx->nat_mem.size_expansion_tables)
pr_err("Expansion Table Size:%d\n",
ipa3_ctx->nat_mem.size_expansion_tables);
else
pr_err("Expansion Table Size:%d\n",
ipa3_ctx->nat_mem.size_expansion_tables-1);
if (!ipa3_ctx->nat_mem.is_sys_mem)
@ -1524,6 +1528,8 @@ static ssize_t ipa3_read_nat4(struct file *file,
pr_err("\nBase Table:\n");
} else {
if (!ipa3_ctx->nat_mem.size_expansion_tables)
continue;
tbl_size = ipa3_ctx->nat_mem.size_expansion_tables-1;
base_tbl =
(u32 *)ipa3_ctx->nat_mem.ipv4_expansion_rules_addr;
@ -1623,6 +1629,8 @@ static ssize_t ipa3_read_nat4(struct file *file,
pr_err("\nIndex Table:\n");
} else {
if (!ipa3_ctx->nat_mem.size_expansion_tables)
continue;
tbl_size = ipa3_ctx->nat_mem.size_expansion_tables-1;
indx_tbl =
(u32 *)ipa3_ctx->nat_mem.index_table_expansion_addr;