summaryrefslogtreecommitdiff
path: root/crypto/lrw.c
diff options
context:
space:
mode:
authorRobert Richter <rrichter@amd.com>2021-03-24 15:16:35 +0100
committerDan Williams <dan.j.williams@intel.com>2021-04-06 11:41:35 -0700
commit392be0bda730df3c71241b2a16bbecac78ee627d (patch)
tree0cf234b6dd0ea3c4a4afe65194b422aa09a5a7c4 /crypto/lrw.c
parent7eda6457a9ca4dc9754e1158c3794e4487ea4392 (diff)
cxl/mem: Force array size of mem_commands[] to CXL_MEM_COMMAND_ID_MAX
Typically the mem_commands[] array is in sync with 'enum { CXL_CMDS }'. Current code works well. However, the array size of mem_commands[] may not strictly be the same as CXL_MEM_COMMAND_ID_MAX. E.g. if a new CXL_CMD() is added that is guarded by #ifdefs, the array could be shorter. This could lead then further to an out-of-bounds array access in cxl_validate_cmd_from_user(). Fix this by forcing the array size to CXL_MEM_COMMAND_ID_MAX. This also adds range checks for array items in mem_commands[] at compile time. Signed-off-by: Robert Richter <rrichter@amd.com> Link: https://lore.kernel.org/r/20210324141635.22335-1-rrichter@amd.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'crypto/lrw.c')
0 files changed, 0 insertions, 0 deletions