Files
android_kernel_samsung_sm86…/msm/eva/msm_cvp.h
Aniruddh Sharma c96b96ee2d msm: eva: Correction in the buffer validity check
Offset of kmd_arg is expected to be in words (As we are feeding the
offset in word size from UMD lib). Whereas the validity check function
treats it as bytes which is wrong. This might lead to crash if lager offset
is feed from UMD via ioctl call.

Change-Id: I7de76cea5abe9a34d4194d041af7a3af7550d86d
Signed-off-by: Aniruddh Sharma <quic_anirshar@quicinc.com>
2022-10-31 06:01:36 -07:00

42 خطوط
1.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#ifndef _MSM_CVP_H_
#define _MSM_CVP_H_
#include "msm_cvp_internal.h"
#include "msm_cvp_common.h"
#include "msm_cvp_clocks.h"
#include "msm_cvp_debug.h"
#include "msm_cvp_dsp.h"
static inline bool is_buf_param_valid(u32 buf_num, u32 offset)
{
int max_buf_num;
max_buf_num = sizeof(struct eva_kmd_hfi_packet) /
sizeof(struct cvp_buf_type);
if (buf_num > max_buf_num)
return false;
if ((offset * sizeof(u32) + buf_num * sizeof(struct cvp_buf_type)) >
sizeof(struct eva_kmd_hfi_packet))
return false;
return true;
}
int msm_cvp_handle_syscall(struct msm_cvp_inst *inst, struct eva_kmd_arg *arg);
int msm_cvp_session_init(struct msm_cvp_inst *inst);
int msm_cvp_session_deinit(struct msm_cvp_inst *inst);
int msm_cvp_session_queue_stop(struct msm_cvp_inst *inst);
int msm_cvp_session_create(struct msm_cvp_inst *inst);
int msm_cvp_session_delete(struct msm_cvp_inst *inst);
int msm_cvp_get_session_info(struct msm_cvp_inst *inst, u32 *session);
int msm_cvp_update_power(struct msm_cvp_inst *inst);
int cvp_clean_session_queues(struct msm_cvp_inst *inst);
#endif