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 <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

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/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to