summaryrefslogtreecommitdiff
path: root/xpp/xpp_zap.c
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-09-06 21:25:15 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-09-06 21:25:15 +0000
commit392e3edc3d7e6d9f9ad1a3dee3a7efa858b9ee41 (patch)
treee89fd31f44eb57ed02f2fc72cd80f0e84520e1d6 /xpp/xpp_zap.c
parent274b05030f73aeb95301c619b86edcf3967bba17 (diff)
Fix problems reported by sparse
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1423 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/xpp_zap.c')
-rw-r--r--xpp/xpp_zap.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/xpp/xpp_zap.c b/xpp/xpp_zap.c
index ffb8934..33ec4c6 100644
--- a/xpp/xpp_zap.c
+++ b/xpp/xpp_zap.c
@@ -716,8 +716,7 @@ int proc_sync_read(char *page, char **start, off_t off, int count, int *eof, voi
static int proc_sync_write(struct file *file, const char __user *buffer, unsigned long count, void *data)
{
- const int NUM_SIZE = 100;
- char buf[NUM_SIZE];
+ char buf[MAX_PROC_WRITE];
int xbus_num;
int xpd_num;
xbus_t *xbus;
@@ -726,7 +725,7 @@ static int proc_sync_write(struct file *file, const char __user *buffer, unsigne
bool setit;
// DBG("%s: count=%ld\n", __FUNCTION__, count);
- if(count >= NUM_SIZE)
+ if(count >= MAX_PROC_WRITE)
return -EINVAL;
if(copy_from_user(buf, buffer, count))
return -EFAULT;
@@ -793,13 +792,12 @@ int proc_xpd_ztregister_read(char *page, char **start, off_t off, int count, int
static int proc_xpd_ztregister_write(struct file *file, const char __user *buffer, unsigned long count, void *data)
{
xpd_t *xpd = data;
- const int NUM_SIZE = 100;
- char buf[NUM_SIZE];
+ char buf[MAX_PROC_WRITE];
bool zt_reg;
int ret;
BUG_ON(!xpd);
- if(count >= NUM_SIZE)
+ if(count >= MAX_PROC_WRITE)
return -EINVAL;
if(copy_from_user(buf, buffer, count))
return -EFAULT;
@@ -1103,7 +1101,7 @@ int xpp_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long arg)
switch (cmd) {
case ZT_ONHOOKTRANSFER:
- if (get_user(x, (int *)arg))
+ if (get_user(x, (int __user *)arg))
return -EFAULT;
xpd->ohttimer[pos] = x << 3;
xpd->idletxhookstate[pos] = FXS_LINE_CID; /* OHT mode when idle */
@@ -1114,7 +1112,7 @@ int xpp_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long arg)
DBG("xpd=%d: ZT_ONHOOKTRANSFER (%d millis) chan=%d\n", xpd->id, x, pos);
return -ENOTTY;
case ZT_TONEDETECT:
- if (get_user(x, (int *)arg))
+ if (get_user(x, (int __user *)arg))
return -EFAULT;
DBG("xpd=%d: ZT_TONEDETECT chan=%d: TONEDETECT_ON=%d TONEDETECT_MUTE=%d\n",
xpd->id, pos, (x & ZT_TONEDETECT_ON), (x & ZT_TONEDETECT_MUTE));