All of lore.kernel.org
 help / color / mirror / Atom feed
* [hch-misc:dma_alloc_noncontiguous 3/10] drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185)
@ 2021-01-27  5:58 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-01-27  5:58 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 3138 bytes --]

tree:   git://git.infradead.org/users/hch/misc.git dma_alloc_noncontiguous
head:   ecc175d8a7100071b073720d6729bb3f40dae639
commit: 6673227deba5cfc9c90084f49988e044a2ca2933 [3/10] WIP videobuf2: rework vb2_mem_ops API
config: x86_64-randconfig-m001-20210126 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185)

vim +/buf +188 drivers/media/common/videobuf2/videobuf2-dma-contig.c

f7f129ce2e33f9 drivers/media/v4l2-core/videobuf2-dma-contig.c        Laurent Pinchart   2012-06-14  182  static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  183  {
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  184  	struct vb2_dc_buf *buf = buf_priv;
6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27 @185  	struct vb2_queue *q = buf->vb->vb2_queue;
                                                                                                                                      ^^^^^
Dereference

c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  186  	int ret;
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  187  
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11 @188  	if (!buf) {
                                                                                                                    ^^^^
NULL check is too late.

1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  189  		printk(KERN_ERR "No buffer to map\n");
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  190  		return -EINVAL;
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  191  	}
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  192  
6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27  193  	ret = dma_mmap_attrs(buf->dev, vma, buf->cookie, buf->dma_addr,
6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27  194  			     buf->size, q->dma_attrs);
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  195  	if (ret) {
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  196  		pr_err("Remapping memory failed, error: %d\n", ret);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34445 bytes --]

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

* [hch-misc:dma_alloc_noncontiguous 3/10] drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185)
@ 2021-01-27  5:58 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-01-27  5:58 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3138 bytes --]

tree:   git://git.infradead.org/users/hch/misc.git dma_alloc_noncontiguous
head:   ecc175d8a7100071b073720d6729bb3f40dae639
commit: 6673227deba5cfc9c90084f49988e044a2ca2933 [3/10] WIP videobuf2: rework vb2_mem_ops API
config: x86_64-randconfig-m001-20210126 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185)

vim +/buf +188 drivers/media/common/videobuf2/videobuf2-dma-contig.c

f7f129ce2e33f9 drivers/media/v4l2-core/videobuf2-dma-contig.c        Laurent Pinchart   2012-06-14  182  static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  183  {
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  184  	struct vb2_dc_buf *buf = buf_priv;
6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27 @185  	struct vb2_queue *q = buf->vb->vb2_queue;
                                                                                                                                      ^^^^^
Dereference

c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  186  	int ret;
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  187  
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11 @188  	if (!buf) {
                                                                                                                    ^^^^
NULL check is too late.

1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  189  		printk(KERN_ERR "No buffer to map\n");
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  190  		return -EINVAL;
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  191  	}
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  192  
6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27  193  	ret = dma_mmap_attrs(buf->dev, vma, buf->cookie, buf->dma_addr,
6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27  194  			     buf->size, q->dma_attrs);
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  195  	if (ret) {
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  196  		pr_err("Remapping memory failed, error: %d\n", ret);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34445 bytes --]

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

* Re: [hch-misc:dma_alloc_noncontiguous 3/10] drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185)
  2021-01-27  5:58 ` Dan Carpenter
  (?)
@ 2021-01-27 12:20 ` Sergey Senozhatsky
  2021-01-27 12:32   ` Christoph Hellwig
  -1 siblings, 1 reply; 6+ messages in thread
From: Sergey Senozhatsky @ 2021-01-27 12:20 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3227 bytes --]

On (21/01/27 08:58), Dan Carpenter wrote:
> tree:   git://git.infradead.org/users/hch/misc.git dma_alloc_noncontiguous
> head:   ecc175d8a7100071b073720d6729bb3f40dae639
> commit: 6673227deba5cfc9c90084f49988e044a2ca2933 [3/10] WIP videobuf2: rework vb2_mem_ops API
> config: x86_64-randconfig-m001-20210126 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> smatch warnings:
> drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185)
> 
> vim +/buf +188 drivers/media/common/videobuf2/videobuf2-dma-contig.c
> 
> f7f129ce2e33f9 drivers/media/v4l2-core/videobuf2-dma-contig.c        Laurent Pinchart   2012-06-14  182  static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
> 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  183  {
> 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  184  	struct vb2_dc_buf *buf = buf_priv;
> 6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27 @185  	struct vb2_queue *q = buf->vb->vb2_queue;
>                                                                                                                                       ^^^^^
> Dereference
> 
> c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  186  	int ret;
> 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  187  
> 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11 @188  	if (!buf) {
>                                                                                                                     ^^^^
> NULL check is too late.
> 
> 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  189  		printk(KERN_ERR "No buffer to map\n");
> 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  190  		return -EINVAL;
> 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  191  	}
> 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  192  
> 6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27  193  	ret = dma_mmap_attrs(buf->dev, vma, buf->cookie, buf->dma_addr,
> 6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27  194  			     buf->size, q->dma_attrs);
> c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  195  	if (ret) {
> c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  196  		pr_err("Remapping memory failed, error: %d\n", ret);

Oh, yeah...

I'll take a look. My WIP branch is not really ready for the show yet.

	-ss

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

* Re: [hch-misc:dma_alloc_noncontiguous 3/10] drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185)
  2021-01-27 12:20 ` Sergey Senozhatsky
@ 2021-01-27 12:32   ` Christoph Hellwig
  2021-01-27 15:41     ` Sergey Senozhatsky
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2021-01-27 12:32 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3437 bytes --]

On Wed, Jan 27, 2021 at 09:20:45PM +0900, Sergey Senozhatsky wrote:
> On (21/01/27 08:58), Dan Carpenter wrote:
> > tree:   git://git.infradead.org/users/hch/misc.git dma_alloc_noncontiguous
> > head:   ecc175d8a7100071b073720d6729bb3f40dae639
> > commit: 6673227deba5cfc9c90084f49988e044a2ca2933 [3/10] WIP videobuf2: rework vb2_mem_ops API
> > config: x86_64-randconfig-m001-20210126 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > smatch warnings:
> > drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185)
> > 
> > vim +/buf +188 drivers/media/common/videobuf2/videobuf2-dma-contig.c
> > 
> > f7f129ce2e33f9 drivers/media/v4l2-core/videobuf2-dma-contig.c        Laurent Pinchart   2012-06-14  182  static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
> > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  183  {
> > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  184  	struct vb2_dc_buf *buf = buf_priv;
> > 6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27 @185  	struct vb2_queue *q = buf->vb->vb2_queue;
> >                                                                                                                                       ^^^^^
> > Dereference
> > 
> > c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  186  	int ret;
> > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  187  
> > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11 @188  	if (!buf) {
> >                                                                                                                     ^^^^
> > NULL check is too late.
> > 
> > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  189  		printk(KERN_ERR "No buffer to map\n");
> > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  190  		return -EINVAL;
> > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  191  	}
> > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  192  
> > 6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27  193  	ret = dma_mmap_attrs(buf->dev, vma, buf->cookie, buf->dma_addr,
> > 6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27  194  			     buf->size, q->dma_attrs);
> > c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  195  	if (ret) {
> > c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  196  		pr_err("Remapping memory failed, error: %d\n", ret);
> 
> Oh, yeah...
> 
> I'll take a look. My WIP branch is not really ready for the show yet.

Could also be that I messed it up when porting to the new API..

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

* Re: [hch-misc:dma_alloc_noncontiguous 3/10] drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185)
  2021-01-27 12:32   ` Christoph Hellwig
@ 2021-01-27 15:41     ` Sergey Senozhatsky
  0 siblings, 0 replies; 6+ messages in thread
From: Sergey Senozhatsky @ 2021-01-27 15:41 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3279 bytes --]

On (21/01/27 13:32), Christoph Hellwig wrote:
> > > smatch warnings:
> > > drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185)
> > > 
> > > vim +/buf +188 drivers/media/common/videobuf2/videobuf2-dma-contig.c
> > > 
> > > f7f129ce2e33f9 drivers/media/v4l2-core/videobuf2-dma-contig.c        Laurent Pinchart   2012-06-14  182  static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
> > > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  183  {
> > > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  184  	struct vb2_dc_buf *buf = buf_priv;
> > > 6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27 @185  	struct vb2_queue *q = buf->vb->vb2_queue;
> > >                                                                                                                                       ^^^^^
> > > Dereference
> > > 
> > > c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  186  	int ret;
> > > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  187  
> > > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11 @188  	if (!buf) {
> > >                                                                                                                     ^^^^
> > > NULL check is too late.
> > > 
> > > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  189  		printk(KERN_ERR "No buffer to map\n");
> > > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  190  		return -EINVAL;
> > > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  191  	}
> > > 1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  192  
> > > 6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27  193  	ret = dma_mmap_attrs(buf->dev, vma, buf->cookie, buf->dma_addr,
> > > 6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27  194  			     buf->size, q->dma_attrs);
> > > c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  195  	if (ret) {
> > > c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  196  		pr_err("Remapping memory failed, error: %d\n", ret);
> > 
> > Oh, yeah...
> > 
> > I'll take a look. My WIP branch is not really ready for the show yet.
> 
> Could also be that I messed it up when porting to the new API..

Rather unlikely ;)

I'm reworking some of the patches in my WIP branch. For instance, I
don't think that reading queue->flags is ->preare and ->finish is
correct: the queue can be reconfigured while the buffers are still
on the fly, so we'll read stale data. So vb2_queue->non_consistent_mem
should be store in buffers, during allocation.

Need some more time.

	-ss

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

* [hch-misc:dma_alloc_noncontiguous 3/10] drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185)
@ 2021-01-26 22:58 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-01-26 22:58 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 5411 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
CC: Christoph Hellwig <hch@lst.de>

tree:   git://git.infradead.org/users/hch/misc.git dma_alloc_noncontiguous
head:   ecc175d8a7100071b073720d6729bb3f40dae639
commit: 6673227deba5cfc9c90084f49988e044a2ca2933 [3/10] WIP videobuf2: rework vb2_mem_ops API
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: x86_64-randconfig-m001-20210126 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185)

vim +/buf +188 drivers/media/common/videobuf2/videobuf2-dma-contig.c

1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  181  
f7f129ce2e33f9 drivers/media/v4l2-core/videobuf2-dma-contig.c        Laurent Pinchart   2012-06-14  182  static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  183  {
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  184  	struct vb2_dc_buf *buf = buf_priv;
6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27 @185  	struct vb2_queue *q = buf->vb->vb2_queue;
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  186  	int ret;
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  187  
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11 @188  	if (!buf) {
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  189  		printk(KERN_ERR "No buffer to map\n");
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  190  		return -EINVAL;
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  191  	}
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  192  
6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27  193  	ret = dma_mmap_attrs(buf->dev, vma, buf->cookie, buf->dma_addr,
6673227deba5cf drivers/media/common/videobuf2/videobuf2-dma-contig.c Sergey Senozhatsky 2020-11-27  194  			     buf->size, q->dma_attrs);
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  195  	if (ret) {
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  196  		pr_err("Remapping memory failed, error: %d\n", ret);
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  197  		return ret;
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  198  	}
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  199  
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  200  	vma->vm_flags		|= VM_DONTEXPAND | VM_DONTDUMP;
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  201  	vma->vm_private_data	= &buf->handler;
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  202  	vma->vm_ops		= &vb2_common_vm_ops;
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  203  
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  204  	vma->vm_ops->open(vma);
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  205  
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  206  	pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n",
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  207  		__func__, (unsigned long)buf->dma_addr, vma->vm_start,
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  208  		buf->size);
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  209  
c60520fa50cd86 drivers/media/v4l2-core/videobuf2-dma-contig.c        Marek Szyprowski   2012-06-14  210  	return 0;
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  211  }
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c            Pawel Osciak       2010-10-11  212  

:::::: The code at line 188 was first introduced by commit
:::::: 1a758d4e847f7743ac1b5aa79fde3ba2d8b5132b [media] v4l: videobuf2: add DMA coherent allocator

:::::: TO: Pawel Osciak <p.osciak@samsung.com>
:::::: CC: Mauro Carvalho Chehab <mchehab@redhat.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34445 bytes --]

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

end of thread, other threads:[~2021-01-27 15:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27  5:58 [hch-misc:dma_alloc_noncontiguous 3/10] drivers/media/common/videobuf2/videobuf2-dma-contig.c:188 vb2_dc_mmap() warn: variable dereferenced before check 'buf' (see line 185) Dan Carpenter
2021-01-27  5:58 ` Dan Carpenter
2021-01-27 12:20 ` Sergey Senozhatsky
2021-01-27 12:32   ` Christoph Hellwig
2021-01-27 15:41     ` Sergey Senozhatsky
  -- strict thread matches above, loose matches on Subject: below --
2021-01-26 22:58 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.