diff options
author | Anca Jeanina Floarea <anca.floarea@freescale.com> | 2014-09-17 15:07:38 (GMT) |
---|---|---|
committer | Matthew Weigel <Matthew.Weigel@freescale.com> | 2014-12-11 18:39:32 (GMT) |
commit | 8572340361bed44ac4133bc7af91bdc92489d474 (patch) | |
tree | f8f3f6e47213cd274831520c56975faa6132207b /include | |
parent | b41fa90d6d3ab71153d271484cb7967391fecda9 (diff) | |
download | linux-fsl-qoriq-8572340361bed44ac4133bc7af91bdc92489d474.tar.xz |
dpa_offload: Fix DPA Stats issues caused by tainted values
Fix DPA Stats issues related to tainted values by adding
constraints to user-provided parameters.
Signed-off-by: Anca Jeanina Floarea <anca.floarea@freescale.com>
Change-Id: Ib59f89518d96c9102a71be4c673e2d065b0a71f8
Reviewed-on: http://git.am.freescale.net:8181/19070
Reviewed-by: Marian-Cornel Chereji <marian.chereji@freescale.com>
Tested-by: Marian-Cornel Chereji <marian.chereji@freescale.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/fsl_dpa_stats.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/linux/fsl_dpa_stats.h b/include/linux/fsl_dpa_stats.h index a411e66..927b2c2 100644 --- a/include/linux/fsl_dpa_stats.h +++ b/include/linux/fsl_dpa_stats.h @@ -51,6 +51,16 @@ /* Maximum number of class counter members */ #define DPA_STATS_MAX_NUM_OF_CLASS_MEMBERS 256 +/* Number of bytes occupied by one counter selection */ +#define DPA_STATS_CNT_SEL_LEN 4 + +/* Maximum size occupied by storage area: 10 MB */ +#define DPA_STATS_MAX_STORAGE_AREA_SIZE (10 * (1 << 20)) + +/* Maximum number of counters that can be processed in a request. Each counter + * can be repeated a maximum of two times in a request */ +#define DPA_STATS_REQ_CNTS_IDS_LEN (2 * DPA_STATS_MAX_NUM_OF_COUNTERS) + /* DPA Stats instance parameters */ struct dpa_stats_params { @@ -61,7 +71,8 @@ struct dpa_stats_params { * will be written by the DPA Stats instance */ void *storage_area; - /* Length in bytes of the storage memory area */ + /* Length in bytes of the storage memory area (must be between + * DPA_STATS_CNT_SEL_LEN and DPA_STATS_MAX_STORAGE_AREA_SIZE) */ unsigned int storage_area_len; }; @@ -83,7 +94,8 @@ struct dpa_stats_cnt_request_params { /* Array of counter IDs to retrieve values for */ int *cnts_ids; - /* Size of array of counters to retrieve values for */ + /* Size of array of counters to retrieve values for (must be between + * 1 and DPA_STATS_REQ_CNTS_IDS_LEN) */ unsigned int cnts_ids_len; /* Reset counters after the retrieve operation */ |