summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2018-05-02 04:54:39 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2018-05-02 04:54:38 -0700
commitaab4834f1e05bccb712c8abf6bad3cd4fdb5200c (patch)
tree0254d0894f4dd8018af914e49fc7acbd94836e6c
parentc38b8343986363b2ea42f82d68bfb79eab6bc7db (diff)
parent31c280fe3455b47273d5b490d96c61c75b77b059 (diff)
Merge "diag: Validate query dci event and log mask size properly"
-rw-r--r--drivers/char/diag/diag_dci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/diag/diag_dci.c b/drivers/char/diag/diag_dci.c
index 16ff781cde65..b0b36d00415d 100644
--- a/drivers/char/diag/diag_dci.c
+++ b/drivers/char/diag/diag_dci.c
@@ -689,7 +689,7 @@ int diag_dci_query_log_mask(struct diag_dci_client_tbl *entry,
byte_mask = 0x01 << (item_num % 8);
offset = equip_id * 514;
- if (offset + byte_index > DCI_LOG_MASK_SIZE) {
+ if (offset + byte_index >= DCI_LOG_MASK_SIZE) {
pr_err("diag: In %s, invalid offset: %d, log_code: %d, byte_index: %d\n",
__func__, offset, log_code, byte_index);
return 0;
@@ -716,7 +716,7 @@ int diag_dci_query_event_mask(struct diag_dci_client_tbl *entry,
bit_index = event_id % 8;
byte_mask = 0x1 << bit_index;
- if (byte_index > DCI_EVENT_MASK_SIZE) {
+ if (byte_index >= DCI_EVENT_MASK_SIZE) {
pr_err("diag: In %s, invalid, event_id: %d, byte_index: %d\n",
__func__, event_id, byte_index);
return 0;