msm: cvp:fix potential prop_array idx out range

fix potential issue that idx of prop_array could be out of range

Change-Id: Ia2d6a7332f66f518b2f8d96ed999e3963f1b9284
Signed-off-by: Yu SI <ysi@codeaurora.org>
This commit is contained in:
Yu SI 2020-06-12 17:42:16 -07:00 • committed by Gerrit - the friendly Code Review server
commit e7ba166ed8
2 changed files with 3 additions and 2 deletions

View file

@ -1125,7 +1125,7 @@ static int msm_cvp_set_sysprop(struct msm_cvp_inst *inst,
return -EINVAL;
}
if (props->prop_num >= MAX_KMD_PROP_NUM) {
if (props->prop_num >= MAX_KMD_PROP_NUM_PER_PACKET) {
dprintk(CVP_ERR, "Too many properties %d to set\n",
props->prop_num);
return -E2BIG;

View file

@ -149,7 +149,8 @@ struct cvp_kmd_hfi_packet {
#define CVP_KMD_PROP_PWR_DDR_OP 0x1C
#define CVP_KMD_PROP_PWR_SYSCACHE_OP 0x1D
#define MAX_KMD_PROP_NUM (CVP_KMD_PROP_PWR_SYSCACHE_OP + 1)
#define MAX_KMD_PROP_NUM_PER_PACKET 8
#define MAX_KMD_PROP_TYPE (CVP_KMD_PROP_PWR_SYSCACHE_OP + 1)
struct cvp_kmd_sys_property {
__u32 prop_type;