Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/misc/mathworks/mathworks_ip_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
struct mathworks_ip_dma_info dinfo;

/* Copy the struct from user space */
if( copy_from_user(&dinfo, (struct mathworks_ip_dma_info *)arg, sizeof(struct mathworks_ip_dma_info)) ) {

Check warning on line 107 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

sparse: incorrect type in argument 2 (different address spaces)
return -EACCES;
}

Expand All @@ -113,7 +113,7 @@
dinfo.phys = (void *)((uintptr_t)thisIpcore->dma_info.phys);

/* Copy the struct back to user space */
if( copy_to_user((struct mathworks_ip_dma_info*)arg, &dinfo, sizeof(struct mathworks_ip_dma_info)) ) {

Check warning on line 116 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

sparse: incorrect type in argument 1 (different address spaces)
return -EACCES;
}

Expand All @@ -126,7 +126,7 @@
struct mathworks_ip_reg_info rinfo;

/* Copy the struct from user space */
if( copy_from_user(&rinfo, (struct mathworks_ip_reg_info *)arg, sizeof(struct mathworks_ip_reg_info)) ) {

Check warning on line 129 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

sparse: incorrect type in argument 2 (different address spaces)
return -EACCES;
}

Expand All @@ -135,7 +135,7 @@
rinfo.phys = (void *)((uintptr_t)thisIpcore->mem->start);

/* Copy the struct back to user space */
if( copy_to_user((struct mathworks_ip_reg_info*)arg, &rinfo, sizeof(struct mathworks_ip_reg_info)) ) {

Check warning on line 138 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

sparse: incorrect type in argument 1 (different address spaces)
return -EACCES;
}

Expand Down Expand Up @@ -193,14 +193,14 @@
static void mathworks_ip_mmap_dma_open(struct vm_area_struct *vma)
{
struct mathworks_ip_info * thisIpcore = vma->vm_private_data;
dev_info(thisIpcore->dev, "DMA VMA open, virt %lx, phys %lx \n", vma->vm_start, vma->vm_pgoff << PAGE_SHIFT);

Check warning on line 196 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

smatch: inconsistent indenting

}

static void mathworks_ip_mmap_dma_close(struct vm_area_struct *vma)
{
struct mathworks_ip_info * thisIpcore = vma->vm_private_data;
dev_info(thisIpcore->dev, "DMA VMA close.\n");

Check warning on line 203 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

smatch: inconsistent indenting

/* Free the memory DMA */
dmam_free_coherent(thisIpcore->dev,thisIpcore->dma_info.size,
Expand All @@ -213,14 +213,14 @@
static void mathworks_ip_mmap_open(struct vm_area_struct *vma)
{
struct mathworks_ip_info * thisIpcore = vma->vm_private_data;
dev_info(thisIpcore->dev, "Simple VMA open, virt %lx, phys %lx \n", vma->vm_start, vma->vm_pgoff << PAGE_SHIFT);

Check warning on line 216 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

smatch: inconsistent indenting

}

static void mathworks_ip_mmap_close(struct vm_area_struct *vma)
{
struct mathworks_ip_info * thisIpcore = vma->vm_private_data;
dev_info(thisIpcore->dev, "Simple VMA close.\n");

Check warning on line 223 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

smatch: inconsistent indenting
}


Expand All @@ -231,7 +231,7 @@
struct page *thisPage;
unsigned long offset;
offset = (vmf->pgoff - vma->vm_pgoff) << PAGE_SHIFT;
thisPage = virt_to_page((void *)(thisIpcore->mem->start + offset));
thisPage = virt_to_page((void *)(uintptr_t)(thisIpcore->mem->start + offset));

Check warning on line 234 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / checks / checks

checkpatch: please, no spaces at the start of a line + thisPage = virt_to_page((void *)(uintptr_t)(thisIpcore->mem->start + offset));$
get_page(thisPage);
vmf->page = thisPage;
return 0;
Expand All @@ -252,7 +252,7 @@
{
struct mathworks_ip_info *thisIpcore = fp->private_data;
size_t size = vma->vm_end - vma->vm_start;
int status = 0;

Check warning on line 255 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

smatch: inconsistent indenting
vma->vm_private_data = thisIpcore;

dev_info(thisIpcore->dev, "[MMAP] size:%X pgoff: %lx\n", (unsigned int)size, vma->vm_pgoff);
Expand All @@ -263,7 +263,7 @@
return -ENOMEM;
}
/* mmap the MMIO base address */
vm_flags_set(vma, VM_IO | VM_DONTDUMP | VM_DONTDUMP); // may be redundant with call to remap_pfn_range below

Check warning on line 266 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / checks / checks

coccicheck: 29-40 duplicated argument to & or |
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
if (remap_pfn_range(vma, vma->vm_start,
thisIpcore->mem->start >> PAGE_SHIFT,
Expand Down Expand Up @@ -303,7 +303,7 @@
{
/* struct ipcore_info *thisIpcore = fp->private_data; */
int status;
struct mathworks_ip_info *thisIpcore = fp->private_data;

Check warning on line 306 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

smatch: inconsistent indenting

if (NULL==thisIpcore) {
return -ENODEV;
Expand Down Expand Up @@ -371,7 +371,7 @@
static int mathworks_ip_setup_cdev(struct mathworks_ip_info *thisIpcore)
{
int status = 0;
struct mathworks_ip_dev_info *dev_entry;

Check warning on line 374 in drivers/misc/mathworks/mathworks_ip_common.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

smatch: inconsistent indenting

if(mathworks_ip_class == NULL){
return -EPROBE_DEFER;
Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/mathworks/mw_stream_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
struct mathworks_ip_info *mw_ip_info;
struct mathworks_ipcore_dev *mw_ipcore_dev;
struct mwadma_dev *mwdev;
if (inode == NULL)

Check warning on line 58 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

smatch: inconsistent indenting
{
MW_DBG_text("INODE is NULL\n");
}
mw_ip_info = container_of(inode->i_cdev, struct mathworks_ip_info, cdev);

Check failure on line 62 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

smatch: we previously assumed 'inode' could be null (see line 58)

Check warning on line 62 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Dereference of null pointer [core.NullDereference] 62 | mw_ip_info = container_of(inode->i_cdev, struct mathworks_ip_info, cdev); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mw_ipcore_dev = (struct mathworks_ipcore_dev *)mw_ip_info->private;
mwdev = (struct mwadma_dev *)mw_ipcore_dev->private;
fp->private_data = mwdev;
Expand Down Expand Up @@ -283,7 +283,7 @@
dma_cookie_t ck;
unsigned long flags;
if(NULL == mwchan) {
dev_err(&mwchan->dev, "mw-axidma: Channel queue pointer is NULL.\n");

Check warning on line 286 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / checks / checks

coccicheck: 25-28 ERROR mwchan is NULL but dereferenced.
ret = -ENODEV;
goto start_failed;
}
Expand Down Expand Up @@ -344,7 +344,7 @@
switch(cmd)
{
case MWADMA_SETUP_RX_CHANNEL:
if(copy_from_user(&usrbuf, (struct mw_axidma_params *)arg, sizeof(struct mw_axidma_params)))

Check warning on line 347 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

sparse: incorrect type in argument 2 (different address spaces)
{
return -EACCES;
}
Expand All @@ -356,7 +356,7 @@
ret = mw_axidma_setupchannel(mwdev, mwchan, &usrbuf);
break;
case MWADMA_RX_SINGLE:
if(copy_from_user(&userval, (unsigned long *)arg, sizeof(userval))) {

Check warning on line 359 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

sparse: incorrect type in argument 2 (different address spaces)
return -EACCES;
}
mwchan->callback = (dma_async_tx_callback)mwadma_rx_cb_single_signal;
Expand All @@ -367,7 +367,7 @@
ret = mwadma_start(mwchan);
break;
case MWADMA_RX_BURST:
if(copy_from_user(&userval, (unsigned long *)arg, sizeof(userval)))

Check warning on line 370 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

sparse: incorrect type in argument 2 (different address spaces)
{
return -EACCES;
}
Expand All @@ -389,7 +389,7 @@
spin_unlock_bh(&mwchan->slock);
break;
case MWADMA_RX_CONTINUOUS:
if(copy_from_user(&userval, (unsigned long *)arg, sizeof(userval))) {

Check warning on line 392 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

sparse: incorrect type in argument 2 (different address spaces)
return -EACCES;
}
mwchan->callback = (dma_async_tx_callback)mwadma_rx_cb_continuous_signal;
Expand Down Expand Up @@ -425,19 +425,19 @@
if (NULL == tmp) {
return -ENOMEM;
}
if(copy_to_user((unsigned int *) arg, &next_index, sizeof(next_index))) {

Check warning on line 428 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

sparse: incorrect type in argument 1 (different address spaces)
return -EACCES;
}
break;
case MWADMA_RX_GET_ERROR:
if(copy_from_user(&done_index, (unsigned int *)arg, sizeof(done_index))) {

Check warning on line 433 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

sparse: incorrect type in argument 2 (different address spaces)
return -EACCES;
}
spin_lock_irqsave(&mwchan->slock, flags);
mwchan->transfer_queued--;
error = mwchan->error;
mwchan->error = 0;
mwchan->blocks[done_index]->state = MWDMA_READY;

Check warning on line 440 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

smatch: potential spectre issue 'mwchan->blocks' [w]
spin_unlock_irqrestore(&mwchan->slock, flags);
atomic64_dec_if_positive(&rxcount);
if(copy_to_user((unsigned int *) arg, &error, sizeof(error))) {
Expand Down Expand Up @@ -476,7 +476,7 @@
{
return -ENOMEM;
}
ret = mw_axidma_setupchannel(mwdev, mwchan, &usrbuf);

Check warning on line 479 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'ret' is never read [deadcode.DeadStores] 479 | ret = mw_axidma_setupchannel(mwdev, mwchan, &usrbuf); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
break;

case MWADMA_TX_ENQUEUE:
Expand Down Expand Up @@ -625,7 +625,7 @@
case MWADMA_GET_PROPERTIES:
usrbuf.size = MWDEV_TO_MWIP(mwdev)->dma_info.size;
usrbuf.phys = (dma_addr_t)MWDEV_TO_MWIP(mwdev)->dma_info.phys;
if(copy_to_user((struct mw_axidma_params *)arg, &usrbuf, sizeof(struct mw_axidma_params))) {

Check warning on line 628 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

smatch: check that 'usrbuf.offset' doesn't leak information
return -EACCES;
}
break;
Expand Down Expand Up @@ -773,7 +773,7 @@
struct page *thisPage;
unsigned long offset;
offset = (vmf->pgoff - vma->vm_pgoff) << PAGE_SHIFT;
thisPage = virt_to_page((void *)(MWDEV_TO_MWIP(mwdev)->mem->start + offset));
thisPage = virt_to_page((void *)(uintptr_t)(MWDEV_TO_MWIP(mwdev)->mem->start + offset));

Check warning on line 776 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / checks / checks

checkpatch: please, no spaces at the start of a line + thisPage = virt_to_page((void *)(uintptr_t)(MWDEV_TO_MWIP(mwdev)->mem->start + offset));$
get_page(thisPage);
vmf->page = thisPage;
return 0;
Expand Down Expand Up @@ -833,7 +833,7 @@
}
dev_dbg(IP2DEVP(mwdev), "dma setup_cdev successful\n");

status = 0;

Check warning on line 836 in drivers/misc/mathworks/mw_stream_channel.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'status' is never read [deadcode.DeadStores] 836 | status = 0; | ^ ~
if (MWDEV_TO_MWIP(mwdev)->dma_info.virt == NULL){
return -EINVAL;
}
Expand Down
Loading