diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2008-10-28 21:49:02 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2008-10-28 21:49:02 +0000 |
commit | cb2fd65e3da7a68ef11d458e9ca99463f90b32a0 (patch) | |
tree | 8acd0b016433ced01fd64876a031381c822c30aa /drivers/dahdi/wctdm.c | |
parent | 8b0e06e5f588d24af0666b1d605084a83c7c8c25 (diff) |
fix a large number of warnings found by sparse, the kernel code sanity checking tool. some of these fixes are non-optimal (casting 'unsigned long' to '__user void *'), but are unavoidable in many cases. started from tzafrir's patch, did most of the work myself.
(closes issue #13763)
Reported by: tzafrir
Patches:
sparse_fixes_1.diff uploaded by tzafrir (license 46)
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@5162 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wctdm.c')
-rw-r--r-- | drivers/dahdi/wctdm.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/dahdi/wctdm.c b/drivers/dahdi/wctdm.c index 09f079c..036f418 100644 --- a/drivers/dahdi/wctdm.c +++ b/drivers/dahdi/wctdm.c @@ -1791,7 +1791,7 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long case DAHDI_ONHOOKTRANSFER: if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS) return -EINVAL; - if (get_user(x, (int *)data)) + if (get_user(x, (__user int *) data)) return -EFAULT; wc->mod[chan->chanpos - 1].fxs.ohttimer = x << 3; if (reversepolarity) @@ -1808,7 +1808,7 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long } break; case DAHDI_SETPOLARITY: - if (get_user(x, (int *)data)) + if (get_user(x, (__user int *) data)) return -EFAULT; if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS) return -EINVAL; @@ -1834,7 +1834,7 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long stats.batvolt = (signed char)wctdm_getreg(wc, chan->chanpos - 1, 29) * 1000; } else return -EINVAL; - if (copy_to_user((struct wctdm_stats *)data, &stats, sizeof(stats))) + if (copy_to_user((__user void *)data, &stats, sizeof(stats))) return -EFAULT; break; case WCTDM_GET_REGS: @@ -1848,11 +1848,11 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long for (x=0;x<NUM_FXO_REGS;x++) regs.direct[x] = wctdm_getreg(wc, chan->chanpos - 1, x); } - if (copy_to_user((struct wctdm_regs *)data, ®s, sizeof(regs))) + if (copy_to_user((__user void *)data, ®s, sizeof(regs))) return -EFAULT; break; case WCTDM_SET_REG: - if (copy_from_user(®op, (struct wctdm_regop *)data, sizeof(regop))) + if (copy_from_user(®op, (__user void *) data, sizeof(regop))) return -EFAULT; if (regop.indirect) { if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS) @@ -1867,7 +1867,7 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long break; case WCTDM_SET_ECHOTUNE: printk(KERN_INFO "-- Setting echo registers: \n"); - if (copy_from_user(&echoregs, (struct wctdm_echo_coefs*)data, sizeof(echoregs))) + if (copy_from_user(&echoregs, (__user void *)data, sizeof(echoregs))) return -EFAULT; if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXO) { @@ -1893,7 +1893,7 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long } break; case DAHDI_SET_HWGAIN: - if (copy_from_user(&hwgain, (struct dahdi_hwgain*) data, sizeof(hwgain))) + if (copy_from_user(&hwgain, (__user void *) data, sizeof(hwgain))) return -EFAULT; wctdm_set_hwgain(wc, chan->chanpos-1, hwgain.newgain, hwgain.tx); @@ -2322,8 +2322,6 @@ static int __devinit wctdm_init_one(struct pci_dev *pdev, const struct pci_devic if (wctdm_hardware_init(wc)) { - unsigned char x; - /* Set Reset Low */ x=inb(wc->ioaddr + WC_CNTL); outb((~0x1)&x, wc->ioaddr + WC_CNTL); @@ -2420,12 +2418,12 @@ static struct pci_device_id wctdm_pci_tbl[] = { MODULE_DEVICE_TABLE(pci, wctdm_pci_tbl); static struct pci_driver wctdm_driver = { - name: "wctdm", - probe: wctdm_init_one, - remove: __devexit_p(wctdm_remove_one), - suspend: NULL, - resume: NULL, - id_table: wctdm_pci_tbl, + .name = "wctdm", + .probe = wctdm_init_one, + .remove =__devexit_p(wctdm_remove_one), + .suspend = NULL, + .resume = NULL, + .id_table = wctdm_pci_tbl, }; static int __init wctdm_init(void) |