coverity: there is no short pointer judgment. [1/1]

PD#SWPL-23790

Problem:
There is no short pointer judgment.

Solution:
Add null pointer protection.

Verify:
on U212

Change-Id: I46cf33607dc37793ad11442b9b2f9aa63462c560
Signed-off-by: renjiang.han <renjiang.han@amlogic.com>
This commit is contained in:
renjiang.han
2020-04-08 10:16:44 +08:00
committed by Chris
parent 7b0e00814d
commit d26529c348
2 changed files with 22 additions and 16 deletions

View File

@@ -289,13 +289,10 @@ static int ge2d_paint_dst(struct ge2d_context_s *context,
if ((dst_paint_position[2] > dst_cd.width)
|| (dst_paint_position[3] > dst_cd.height)) {
ppmgr2_printk(0, "error: id %d,width %d,height %d, ",
dst_canvas_id,
dst_cd.width,
dst_cd.height);
ppmgr2_printk(0, "dst_width %d,dst_height %d\n",
dst_paint_position[2],
dst_paint_position[3]);
pr_info("ppmgr2-dev: error: id %d,width %d,height %d, ",
dst_canvas_id, dst_cd.width, dst_cd.height);
pr_info("ppmgr2-dev: dst_width %d,dst_height %d\n",
dst_paint_position[2], dst_paint_position[3]);
ppmgr2_printk(1, "error case : dst addr:%p\n",
(void *)dst_cd.addr);
return -1;
@@ -385,20 +382,28 @@ int ppmgr2_init(struct ppmgr2_device *ppd)
int ppmgr2_canvas_config(struct ppmgr2_device *ppd, int index)
{
int canvas_width = ppd->dst_buffer_width;
int canvas_height = ppd->dst_buffer_height;
void *phy_addr;
int canvas_width;
int canvas_height;
void *phy_addr = NULL;
if (!ppd->phy_addr) {
ppmgr2_printk(1, "NULL physical address!\n");
if (IS_ERR_OR_NULL(ppd)) {
ppmgr2_printk(1, "ppd is NULL or error\n");
return -1;
}
canvas_width = ppd->dst_buffer_width;
canvas_height = ppd->dst_buffer_height;
if (index >= PPMGR2_MAX_CANVAS) {
pr_info("ppmgr2-dev: canvas index too large! %d>=%d\n",
index, PPMGR2_MAX_CANVAS);
return -1;
}
phy_addr = ppd->phy_addr[index];
if (index >= PPMGR2_MAX_CANVAS) {
ppmgr2_printk(0, "canvas index too large! %d>=%d\n", index,
PPMGR2_MAX_CANVAS);
if (IS_ERR_OR_NULL(phy_addr)) {
ppmgr2_printk(1, "NULL physical address!\n");
return -1;
}

View File

@@ -275,7 +275,8 @@ static int video_receiver_event_fun(int type, void *data, void *private_data)
if (vf_get_receiver(dev->vf_provider_name)) {
struct vframe_receiver_s *aaa = vf_get_receiver(
dev->vf_provider_name);
AMLVIDEO_DBG("aaa->name=%s", aaa->name);
if (aaa)
AMLVIDEO_DBG("aaa->name=%s", aaa->name);
if (dev->inst == 0)
omx_secret_mode = true;
vfq_init(&dev->q_ready, AMLVIDEO_POOL_SIZE + 1,