Commit 9200a62c authored by Randy Dunlap's avatar Randy Dunlap Committed by Steve French

[PATCH] janitor: drivers/telephony/ixj

From: Daniele Bellucci <bellucda@tiscali.it>

This is an audit (copy_*_user), cleanup, and coding-style fix
for this driver.
parent 2c420d4a
......@@ -23,6 +23,7 @@
* Fixes: David Huggins-Daines, <dhd@cepstral.com>
* Fabio Ferrari, <fabio.ferrari@digitro.com.br>
* Artis Kugevics, <artis@mt.lv>
* Daniele Bellucci, <bellucda@tiscali.it>
*
* More information about the hardware related to this driver can be found
* at our website: http://www.quicknet.net
......@@ -45,6 +46,10 @@ static char ixj_c_revision[] = "$Revision: 4.7 $";
/*
* $Log: ixj.c,v $
*
* Revision 4.8 2003/07/09 19:39:00 Daniele Bellucci
* Audit some copy_*_user and minor cleanup.
*
* Revision 4.7 2001/08/13 06:19:33 craigs
* Added additional changes from Alan Cox and John Anderson for
* 2.2 to 2.4 cleanup and bounds checking
......@@ -363,12 +368,9 @@ static IXJ ixj[IXJMAX];
static IXJ *ixj_alloc(void)
{
int cnt;
for(cnt=0; cnt<IXJMAX; cnt++)
{
for(cnt=0; cnt<IXJMAX; cnt++) {
if(!ixj[cnt].DSPbase)
{
return &ixj[cnt];
}
}
return NULL;
}
......@@ -6260,9 +6262,11 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd,
break;
case IXJCTL_CIDCW:
if(arg) {
copy_from_user(&j->cid_send, (char *)arg, sizeof(PHONE_CID));
}
else {
if (copy_from_user(&j->cid_send, (char *)arg, sizeof(PHONE_CID))) {
retval = -EFAULT;
break;
}
} else {
memset(&j->cid_send, 0, sizeof(PHONE_CID));
}
ixj_write_cidcw(j);
......@@ -6273,14 +6277,12 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd,
/* Fall through */
case PHONE_RING_START:
if(arg) {
if(copy_from_user(&j->cid_send, (char *)arg, sizeof(PHONE_CID)))
{
if (copy_from_user(&j->cid_send, (char *)arg, sizeof(PHONE_CID))) {
retval = -EFAULT;
break;
}
ixj_write_cid(j);
}
else {
} else {
memset(&j->cid_send, 0, sizeof(PHONE_CID));
}
ixj_ring_start(j);
......@@ -6696,7 +6698,8 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd,
case IXJCTL_SET_FILTER_RAW:
if (copy_from_user(&jfr, (char *) arg, sizeof(jfr)))
retval = -EFAULT;
retval = ixj_init_filter_raw(j, &jfr);
else
retval = ixj_init_filter_raw(j, &jfr);
break;
case IXJCTL_GET_FILTER_HIST:
if(arg<0||arg>3)
......@@ -6705,8 +6708,10 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd,
retval = j->filter_hist[arg];
break;
case IXJCTL_INIT_TONE:
copy_from_user(&ti, (char *) arg, sizeof(ti));
retval = ixj_init_tone(j, &ti);
if (copy_from_user(&ti, (char *) arg, sizeof(ti)))
retval = -EFAULT;
else
retval = ixj_init_tone(j, &ti);
break;
case IXJCTL_TONE_CADENCE:
retval = ixj_build_cadence(j, (IXJ_CADENCE *) arg);
......@@ -6715,8 +6720,10 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd,
retval = ixj_build_filter_cadence(j, (IXJ_FILTER_CADENCE *) arg);
break;
case IXJCTL_SIGCTL:
if (copy_from_user(&j->sigdef, (char *)arg, sizeof(IXJ_SIGDEF)))
if (copy_from_user(&j->sigdef, (char *)arg, sizeof(IXJ_SIGDEF))) {
retval = -EFAULT;
break;
}
j->ixj_signals[j->sigdef.event] = j->sigdef.signal;
if(j->sigdef.event < 33) {
raise = 1;
......@@ -7693,7 +7700,7 @@ MODULE_DESCRIPTION("Quicknet VoIP Telephony card module - www.quicknet.net");
MODULE_AUTHOR("Ed Okerson <eokerson@quicknet.net>");
MODULE_LICENSE("GPL");
void ixj_exit(void)
static void __exit ixj_exit(void)
{
cleanup();
}
......@@ -7852,7 +7859,7 @@ int __init ixj_probe_pci(int *cnt)
return probe;
}
int __init ixj_init(void)
static int __init ixj_init(void)
{
int cnt = 0;
int probe = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment