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