diff options
| author | Chris Lew <clew@codeaurora.org> | 2015-12-22 12:24:37 -0800 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:18:16 -0700 |
| commit | 26d8c657ca323c56719030672a13eea7bc7ab714 (patch) | |
| tree | dfe862cd9c3f1a8b04545f22195248d02a440015 /drivers/char | |
| parent | 1b668751e420df01d4c834dd32db46c4324173a7 (diff) | |
diag: Change to update the range correctly on a range mismatch
Setting message masks with tools outside of the initial range
causes a reallocation of the structure with the wrong size.
This change updates the sizes to the correct values.
Change-Id: I8bb0d0b77cd4d2417b10345b6e4b09ff29ba5f8c
Signed-off-by: Christopher Lew <clew@codeaurora.org>
Diffstat (limited to 'drivers/char')
| -rw-r--r-- | drivers/char/diag/diag_masks.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/char/diag/diag_masks.c b/drivers/char/diag/diag_masks.c index 6d512024823e..a2851234872a 100644 --- a/drivers/char/diag/diag_masks.c +++ b/drivers/char/diag/diag_masks.c @@ -656,7 +656,8 @@ static int diag_cmd_set_msg_mask(unsigned char *src_buf, int src_len, mask = (struct diag_msg_mask_t *)mask_info->ptr; for (i = 0; i < driver->msg_mask_tbl_count; i++, mask++) { if ((req->ssid_first < mask->ssid_first) || - (req->ssid_first > mask->ssid_last_tools)) { + (req->ssid_first > (mask->ssid_first + + MAX_SSID_PER_RANGE))) { continue; } found = 1; @@ -675,8 +676,10 @@ static int diag_cmd_set_msg_mask(unsigned char *src_buf, int src_len, pr_debug("diag: Msg SSID range mismatch\n"); if (mask_size != MAX_SSID_PER_RANGE) mask->ssid_last_tools = req->ssid_last; + mask->range_tools = + mask->ssid_last_tools - mask->ssid_first + 1; temp = krealloc(mask->ptr, - mask_size * sizeof(uint32_t), + mask->range_tools * sizeof(uint32_t), GFP_KERNEL); if (!temp) { pr_err_ratelimited("diag: In %s, unable to allocate memory for msg mask ptr, mask_size: %d\n", @@ -685,7 +688,6 @@ static int diag_cmd_set_msg_mask(unsigned char *src_buf, int src_len, return -ENOMEM; } mask->ptr = temp; - mask->range_tools = mask_size; } offset = req->ssid_first - mask->ssid_first; |
