linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: [media] coda: update CODA7541 to firmware 1.4.50
@ 2013-11-06 16:13 Dan Carpenter
  2014-04-11 11:08 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2013-11-06 16:13 UTC (permalink / raw)
  To: p.zabel; +Cc: linux-media

Hello Philipp Zabel,

This is a semi-automatic email about new static checker warnings.

The patch 5677e3b04d3b: "[media] coda: update CODA7541 to firmware 
1.4.50" from Jun 21, 2013, leads to the following Smatch complaint:

drivers/media/platform/coda.c:1530 coda_alloc_framebuffers()
	 error: we previously assumed 'ctx->codec' could be null (see line 1521)

drivers/media/platform/coda.c
  1520	
  1521		if (ctx->codec && ctx->codec->src_fourcc == V4L2_PIX_FMT_H264)
                    ^^^^^^^^^^
Patch introduces a new NULL check.

  1522			height = round_up(height, 16);
  1523		ysize = round_up(q_data->width, 8) * height;
  1524	
  1525		/* Allocate frame buffers */
  1526		for (i = 0; i < ctx->num_internal_frames; i++) {
  1527			size_t size;
  1528	
  1529			size = q_data->sizeimage;
  1530			if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 &&
                            ^^^^^^^^^^^^^^^^^^^^^^
Patch introduces a new unchecked dereference.

  1531			    dev->devtype->product != CODA_DX6)
  1532				ctx->internal_frames[i].size += ysize/4;

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [media] coda: update CODA7541 to firmware 1.4.50
  2013-11-06 16:13 [media] coda: update CODA7541 to firmware 1.4.50 Dan Carpenter
@ 2014-04-11 11:08 ` Dan Carpenter
  2014-04-11 13:04   ` Fabio Estevam
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2014-04-11 11:08 UTC (permalink / raw)
  To: p.zabel; +Cc: linux-media

What ever happened with this?

regards,
dan carpenter

On Wed, Nov 06, 2013 at 07:13:43PM +0300, Dan Carpenter wrote:
> Hello Philipp Zabel,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 5677e3b04d3b: "[media] coda: update CODA7541 to firmware 
> 1.4.50" from Jun 21, 2013, leads to the following Smatch complaint:
> 
> drivers/media/platform/coda.c:1530 coda_alloc_framebuffers()
> 	 error: we previously assumed 'ctx->codec' could be null (see line 1521)
> 
> drivers/media/platform/coda.c
>   1520	
>   1521		if (ctx->codec && ctx->codec->src_fourcc == V4L2_PIX_FMT_H264)
>                     ^^^^^^^^^^
> Patch introduces a new NULL check.
> 
>   1522			height = round_up(height, 16);
>   1523		ysize = round_up(q_data->width, 8) * height;
>   1524	
>   1525		/* Allocate frame buffers */
>   1526		for (i = 0; i < ctx->num_internal_frames; i++) {
>   1527			size_t size;
>   1528	
>   1529			size = q_data->sizeimage;
>   1530			if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 &&
>                             ^^^^^^^^^^^^^^^^^^^^^^
> Patch introduces a new unchecked dereference.
> 
>   1531			    dev->devtype->product != CODA_DX6)
>   1532				ctx->internal_frames[i].size += ysize/4;
> 
> regards,
> dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [media] coda: update CODA7541 to firmware 1.4.50
  2014-04-11 11:08 ` Dan Carpenter
@ 2014-04-11 13:04   ` Fabio Estevam
  0 siblings, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2014-04-11 13:04 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Philipp Zabel, linux-media

Hi Dan/Philipp,

On Fri, Apr 11, 2014 at 8:08 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> What ever happened with this?
>
> regards,
> dan carpenter
>
> On Wed, Nov 06, 2013 at 07:13:43PM +0300, Dan Carpenter wrote:
>> Hello Philipp Zabel,
>>
>> This is a semi-automatic email about new static checker warnings.
>>
>> The patch 5677e3b04d3b: "[media] coda: update CODA7541 to firmware
>> 1.4.50" from Jun 21, 2013, leads to the following Smatch complaint:
>>
>> drivers/media/platform/coda.c:1530 coda_alloc_framebuffers()
>>        error: we previously assumed 'ctx->codec' could be null (see line 1521)
>>
>> drivers/media/platform/coda.c
>>   1520
>>   1521                if (ctx->codec && ctx->codec->src_fourcc == V4L2_PIX_FMT_H264)
>>                     ^^^^^^^^^^
>> Patch introduces a new NULL check.
>>
>>   1522                        height = round_up(height, 16);
>>   1523                ysize = round_up(q_data->width, 8) * height;
>>   1524
>>   1525                /* Allocate frame buffers */
>>   1526                for (i = 0; i < ctx->num_internal_frames; i++) {
>>   1527                        size_t size;
>>   1528
>>   1529                        size = q_data->sizeimage;
>>   1530                        if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 &&
>>                             ^^^^^^^^^^^^^^^^^^^^^^
>> Patch introduces a new unchecked dereference.
>>
>>   1531                            dev->devtype->product != CODA_DX6)
>>   1532                                ctx->internal_frames[i].size += ysize/4;

Would the fix below address this issue?

--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -1518,7 +1518,10 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx,
        int ret;
        int i;

-       if (ctx->codec && ctx->codec->src_fourcc == V4L2_PIX_FMT_H264)
+       if (!ctx->codec)
+               return -EINVAL;
+
+       if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264)
                height = round_up(height, 16);
        ysize = round_up(q_data->width, 8) * height;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-11 13:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-06 16:13 [media] coda: update CODA7541 to firmware 1.4.50 Dan Carpenter
2014-04-11 11:08 ` Dan Carpenter
2014-04-11 13:04   ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).