Linux Media Controller development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: ming.qian@nxp.com
Cc: linux-media@vger.kernel.org
Subject: [bug report] media: amphion: implement windsor encoder rpc interface
Date: Thu, 10 Mar 2022 09:56:54 +0300	[thread overview]
Message-ID: <20220310065654.GA3476@kili> (raw)

Hello Ming Qian,

The patch d82977796c48: "media: amphion: implement windsor encoder
rpc interface" from Feb 24, 2022, leads to the following Smatch
static checker warning:

	drivers/media/platform/amphion/vpu_windsor.c:823 vpu_windsor_config_memory_resource()
	error: buffer overflow 'pool->enc_frames' 6 <= 7

drivers/media/platform/amphion/vpu_windsor.c
    807 int vpu_windsor_config_memory_resource(struct vpu_shared_addr *shared,
    808                                        u32 instance,
    809                                        u32 type,
    810                                        u32 index,
    811                                        struct vpu_buffer *buf)
    812 {
    813         struct vpu_enc_mem_pool *pool;
    814         struct vpu_enc_memory_resource *res;
    815 
    816         if (instance >= VID_API_NUM_STREAMS)
                                ^^^^^^^^^^^^^^^^^^^
This is 8.

    817                 return -EINVAL;
    818 
    819         pool = get_mem_pool(shared, instance);
    820 
    821         switch (type) {
    822         case MEM_RES_ENC:
--> 823                 res = &pool->enc_frames[index];

This only has WINDSOR_MAX_SRC_FRAMES elements.

    824                 break;
    825         case MEM_RES_REF:
    826                 res = &pool->ref_frames[index];
    827                 break;
    828         case MEM_RES_ACT:
    829                 res = &pool->act_frame;
    830                 break;
    831         default:
    832                 return -EINVAL;
    833         }
    834 
    835         res->phys = buf->phys;
    836         res->virt = buf->phys - shared->boot_addr;
    837         res->size = buf->length;
    838 
    839         return 0;
    840 }

regards,
dan carpenter

             reply	other threads:[~2022-03-10  6:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10  6:56 Dan Carpenter [this message]
2022-03-10  7:34 ` [EXT] [bug report] media: amphion: implement windsor encoder rpc interface Ming Qian
2022-03-10 11:45   ` Dan Carpenter
2022-03-10 13:56     ` 回复: " Ming Qian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220310065654.GA3476@kili \
    --to=dan.carpenter@oracle.com \
    --cc=linux-media@vger.kernel.org \
    --cc=ming.qian@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox