diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2017-04-06 14:33:16 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-04-06 14:33:15 -0700 |
| commit | bce56352aa9dd10c442a212fbb3e3357b2a5471c (patch) | |
| tree | 072b296a28000b7fe1725b20eaab747b12f700ef | |
| parent | 89364febeb19a332b46500e3a99ae8510e1ff0a3 (diff) | |
| parent | d45e41bf0c9a33db182d9bb6b4aaa3926f923a05 (diff) | |
Merge "seemp: fix code analysis issues"
| -rw-r--r-- | drivers/platform/msm/seemp_core/seemp_logk.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/platform/msm/seemp_core/seemp_logk.c b/drivers/platform/msm/seemp_core/seemp_logk.c index 9b6096485c39..d0f21943cb0f 100644 --- a/drivers/platform/msm/seemp_core/seemp_logk.c +++ b/drivers/platform/msm/seemp_core/seemp_logk.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2015, 2017, 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 @@ -184,6 +184,8 @@ static int seemp_logk_usr_record(const char __user *buf, size_t count) if (copy_from_user(&usr_blk.payload, &local_blk->payload, sizeof(struct blk_payload)) != 0) return -EFAULT; + } else { + return -EFAULT; } idx = ret = 0; now = current_kernel_time(); @@ -283,7 +285,12 @@ static bool seemp_logk_get_bit_from_vector(__u8 *pVec, __u32 index) { unsigned int byte_num = index/8; unsigned int bit_num = index%8; - unsigned char byte = pVec[byte_num]; + unsigned char byte; + + if (DIV_ROUND_UP(index, 8) > MASK_BUFFER_SIZE) + return false; + + byte = pVec[byte_num]; return !(byte & (1 << bit_num)); } |
