summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-01-03 18:26:29 +0000
committerShaun Ruffell <sruffell@digium.com>2011-01-03 18:26:29 +0000
commitb5aef822a088200675fdefc60912179e1e367fef (patch)
tree506f8a8425486e4ab9d83c7d5a089012cce7374f
parent4f4a8cc6b125268829e09db494f311f43127c35d (diff)
'dahdi_copy_string()' -> 'strlcpy()'
There is already a safe string copying function in all the kernels DAHDI currently supports. Signed-off-by: Shaun Ruffell <sruffell@digium.com> Acked-by: Kinsey Moore <kmoore@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9585 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/dahdi-base.c37
-rw-r--r--drivers/dahdi/dahdi_dummy.c3
-rw-r--r--drivers/dahdi/dahdi_dynamic.c4
-rw-r--r--drivers/dahdi/dahdi_dynamic_eth.c4
-rw-r--r--drivers/dahdi/dahdi_dynamic_ethmf.c2
-rw-r--r--drivers/dahdi/dahdi_transcode.c2
-rw-r--r--drivers/dahdi/tor2.c2
-rw-r--r--drivers/dahdi/wcb4xxp/base.c3
-rw-r--r--drivers/dahdi/wcfxo.c2
-rw-r--r--drivers/dahdi/wct1xxp.c2
-rw-r--r--drivers/dahdi/wct4xxp/base.c3
-rw-r--r--drivers/dahdi/wctdm.c2
-rw-r--r--drivers/dahdi/wcte11xp.c2
13 files changed, 36 insertions, 32 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index a1ecb8a..a896f63 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -3038,7 +3038,7 @@ static int ioctl_load_zone(unsigned long data)
ptr = (char *) ptr + sizeof(*z);
space -= sizeof(*z);
- dahdi_copy_string(z->name, work->th.name, sizeof(z->name));
+ strlcpy(z->name, work->th.name, sizeof(z->name));
for (x = 0; x < DAHDI_MAX_CADENCE; x++)
z->ringcadence[x] = work->th.ringcadence[x];
@@ -3855,7 +3855,7 @@ static int dahdi_ioctl_getparams(struct file *file, unsigned long data)
param.pulsebreaktime = chan->pulsebreaktime;
param.pulseaftertime = chan->pulseaftertime;
param.spanno = (chan->span) ? chan->span->spanno : 0;
- dahdi_copy_string(param.name, chan->name, sizeof(param.name));
+ strlcpy(param.name, chan->name, sizeof(param.name));
param.chanpos = chan->chanpos;
param.sigcap = chan->sigcap;
/* Return current law */
@@ -3943,8 +3943,8 @@ static int dahdi_ioctl_spanstat(struct file *file, unsigned long data)
spaninfo.spanno = s->spanno; /* put the span # in here */
spaninfo.totalspans = span_count();
- dahdi_copy_string(spaninfo.desc, s->desc, sizeof(spaninfo.desc));
- dahdi_copy_string(spaninfo.name, s->name, sizeof(spaninfo.name));
+ strlcpy(spaninfo.desc, s->desc, sizeof(spaninfo.desc));
+ strlcpy(spaninfo.name, s->name, sizeof(spaninfo.name));
spaninfo.alarms = s->alarms; /* get alarm status */
spaninfo.rxlevel = s->rxlevel; /* get rx level */
spaninfo.txlevel = s->txlevel; /* get tx level */
@@ -3971,20 +3971,20 @@ static int dahdi_ioctl_spanstat(struct file *file, unsigned long data)
spaninfo.lineconfig = s->lineconfig;
spaninfo.irq = s->irq;
spaninfo.linecompat = s->linecompat;
- dahdi_copy_string(spaninfo.lboname, dahdi_lboname(s->lbo),
+ strlcpy(spaninfo.lboname, dahdi_lboname(s->lbo),
sizeof(spaninfo.lboname));
if (s->manufacturer) {
- dahdi_copy_string(spaninfo.manufacturer, s->manufacturer,
+ strlcpy(spaninfo.manufacturer, s->manufacturer,
sizeof(spaninfo.manufacturer));
}
if (s->devicetype) {
- dahdi_copy_string(spaninfo.devicetype, s->devicetype,
+ strlcpy(spaninfo.devicetype, s->devicetype,
sizeof(spaninfo.devicetype));
}
- dahdi_copy_string(spaninfo.location, s->location,
+ strlcpy(spaninfo.location, s->location,
sizeof(spaninfo.location));
if (s->spantype) {
- dahdi_copy_string(spaninfo.spantype, s->spantype,
+ strlcpy(spaninfo.spantype, s->spantype,
sizeof(spaninfo.spantype));
}
@@ -4031,10 +4031,10 @@ static int dahdi_ioctl_spanstat_v1(struct file *file, unsigned long data)
spaninfo_v1.spanno = s->spanno; /* put the span # in here */
spaninfo_v1.totalspans = 0;
spaninfo_v1.totalspans = span_count();
- dahdi_copy_string(spaninfo_v1.desc,
+ strlcpy(spaninfo_v1.desc,
s->desc,
sizeof(spaninfo_v1.desc));
- dahdi_copy_string(spaninfo_v1.name,
+ strlcpy(spaninfo_v1.name,
s->name,
sizeof(spaninfo_v1.name));
spaninfo_v1.alarms = s->alarms;
@@ -4056,28 +4056,28 @@ static int dahdi_ioctl_spanstat_v1(struct file *file, unsigned long data)
spaninfo_v1.lineconfig = s->lineconfig;
spaninfo_v1.irq = s->irq;
spaninfo_v1.linecompat = s->linecompat;
- dahdi_copy_string(spaninfo_v1.lboname,
+ strlcpy(spaninfo_v1.lboname,
dahdi_lboname(s->lbo),
sizeof(spaninfo_v1.lboname));
if (s->manufacturer) {
- dahdi_copy_string(spaninfo_v1.manufacturer,
+ strlcpy(spaninfo_v1.manufacturer,
s->manufacturer,
sizeof(spaninfo_v1.manufacturer));
}
if (s->devicetype) {
- dahdi_copy_string(spaninfo_v1.devicetype,
+ strlcpy(spaninfo_v1.devicetype,
s->devicetype,
sizeof(spaninfo_v1.devicetype));
}
- dahdi_copy_string(spaninfo_v1.location,
+ strlcpy(spaninfo_v1.location,
s->location,
sizeof(spaninfo_v1.location));
if (s->spantype) {
- dahdi_copy_string(spaninfo_v1.spantype,
+ strlcpy(spaninfo_v1.spantype,
s->spantype,
sizeof(spaninfo_v1.spantype));
}
@@ -4644,7 +4644,7 @@ static int dahdi_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long da
size_t space = sizeof(vi.echo_canceller) - 1;
memset(&vi, 0, sizeof(vi));
- dahdi_copy_string(vi.version, DAHDI_VERSION, sizeof(vi.version));
+ strlcpy(vi.version, DAHDI_VERSION, sizeof(vi.version));
read_lock(&ecfactory_list_lock);
list_for_each_entry(cur, &ecfactory_list, list) {
strncat(vi.echo_canceller + strlen(vi.echo_canceller),
@@ -4818,7 +4818,8 @@ static int ioctl_dahdi_dial(struct dahdi_chan *chan, unsigned long data)
rv = -EBUSY;
break;
}
- dahdi_copy_string(chan->txdialbuf + strlen(chan->txdialbuf), tdo->dialstr, DAHDI_MAX_DTMF_BUF - strlen(chan->txdialbuf));
+ strlcpy(chan->txdialbuf + strlen(chan->txdialbuf), tdo->dialstr,
+ DAHDI_MAX_DTMF_BUF - strlen(chan->txdialbuf));
if (!chan->dialing) {
chan->dialing = 1;
__do_dtmf(chan);
diff --git a/drivers/dahdi/dahdi_dummy.c b/drivers/dahdi/dahdi_dummy.c
index 9685f06..16ba6cb 100644
--- a/drivers/dahdi/dahdi_dummy.c
+++ b/drivers/dahdi/dahdi_dummy.c
@@ -210,7 +210,8 @@ static int dahdi_dummy_initialize(struct dahdi_dummy *ztd)
sprintf(ztd->span.name, "DAHDI_DUMMY/1");
snprintf(ztd->span.desc, sizeof(ztd->span.desc) - 1, "%s (source: " CLOCK_SRC ") %d", ztd->span.name, 1);
sprintf(ztd->chan->name, "DAHDI_DUMMY/%d/%d", 1, 0);
- dahdi_copy_string(ztd->span.devicetype, "DAHDI Dummy Timing", sizeof(ztd->span.devicetype));
+ strlcpy(ztd->span.devicetype, "DAHDI Dummy Timing",
+ sizeof(ztd->span.devicetype));
ztd->chan->chanpos = 1;
ztd->span.chans = &ztd->chan;
ztd->span.channels = 0; /* no channels on our span */
diff --git a/drivers/dahdi/dahdi_dynamic.c b/drivers/dahdi/dahdi_dynamic.c
index 5e0d459..c1bba4e 100644
--- a/drivers/dahdi/dahdi_dynamic.c
+++ b/drivers/dahdi/dahdi_dynamic.c
@@ -604,8 +604,8 @@ static int _create_dynamic(struct dahdi_dynamic_span *dds)
}
/* Setup parameters properly assuming we're going to be okay. */
- dahdi_copy_string(d->dname, dds->driver, sizeof(d->dname));
- dahdi_copy_string(d->addr, dds->addr, sizeof(d->addr));
+ strlcpy(d->dname, dds->driver, sizeof(d->dname));
+ strlcpy(d->addr, dds->addr, sizeof(d->addr));
d->timing = dds->timing;
sprintf(d->span.name, "DYN/%s/%s", dds->driver, dds->addr);
sprintf(d->span.desc, "Dynamic '%s' span at '%s'",
diff --git a/drivers/dahdi/dahdi_dynamic_eth.c b/drivers/dahdi/dahdi_dynamic_eth.c
index 2f8aa51..46699f5 100644
--- a/drivers/dahdi/dahdi_dynamic_eth.c
+++ b/drivers/dahdi/dahdi_dynamic_eth.c
@@ -306,12 +306,12 @@ static int ztdeth_create(struct dahdi_dynamic *dyn, const char *addr)
memset(z, 0, sizeof(struct ztdeth));
/* Address should be <dev>/<macaddr>[/subaddr] */
- dahdi_copy_string(tmp, addr, sizeof(tmp));
+ strlcpy(tmp, addr, sizeof(tmp));
tmp2 = strchr(tmp, '/');
if (tmp2) {
*tmp2 = '\0';
tmp2++;
- dahdi_copy_string(z->ethdev, tmp, sizeof(z->ethdev));
+ strlcpy(z->ethdev, tmp, sizeof(z->ethdev));
} else {
printk(KERN_NOTICE "Invalid TDMoE address (no device) '%s'\n", addr);
kfree(z);
diff --git a/drivers/dahdi/dahdi_dynamic_ethmf.c b/drivers/dahdi/dahdi_dynamic_ethmf.c
index fecce48..53845c9 100644
--- a/drivers/dahdi/dahdi_dynamic_ethmf.c
+++ b/drivers/dahdi/dahdi_dynamic_ethmf.c
@@ -609,7 +609,7 @@ static int ztdethmf_create(struct dahdi_dynamic *dyn, const char *addr)
z->rcvbuf = kmalloc(bufsize, GFP_KERNEL);
/* Address should be <dev>/<macaddr>/subaddr */
- dahdi_copy_string(src, addr, sizeof(src));
+ strlcpy(src, addr, sizeof(src));
/* replace all / with space; otherwise kernel sscanf does not work */
src_ptr = src;
while (*src_ptr) {
diff --git a/drivers/dahdi/dahdi_transcode.c b/drivers/dahdi/dahdi_transcode.c
index 8bf886e..075391c 100644
--- a/drivers/dahdi/dahdi_transcode.c
+++ b/drivers/dahdi/dahdi_transcode.c
@@ -328,7 +328,7 @@ static long dahdi_tc_getinfo(unsigned long data)
return -ENOSYS;
}
- dahdi_copy_string(info.name, tc->name, sizeof(info.name));
+ strlcpy(info.name, tc->name, sizeof(info.name));
info.numchannels = tc->numchannels;
info.srcfmts = tc->srcfmts;
info.dstfmts = tc->dstfmts;
diff --git a/drivers/dahdi/tor2.c b/drivers/dahdi/tor2.c
index 396ad05..1babb4f 100644
--- a/drivers/dahdi/tor2.c
+++ b/drivers/dahdi/tor2.c
@@ -284,7 +284,7 @@ static void init_spans(struct tor2 *tor)
"Tormenta 2 (PCI) Quad %s Card %d Span %d",
(tor->cardtype == TYPE_T1) ? "T1" : "E1", tor->num, x + 1);
s->manufacturer = "Digium";
- dahdi_copy_string(s->devicetype, tor->type, sizeof(s->devicetype));
+ strlcpy(s->devicetype, tor->type, sizeof(s->devicetype));
snprintf(s->location, sizeof(s->location) - 1,
"PCI Bus %02d Slot %02d", tor->pci->bus->number, PCI_SLOT(tor->pci->devfn) + 1);
if (tor->cardtype == TYPE_T1) {
diff --git a/drivers/dahdi/wcb4xxp/base.c b/drivers/dahdi/wcb4xxp/base.c
index 087bd6e..70ea418 100644
--- a/drivers/dahdi/wcb4xxp/base.c
+++ b/drivers/dahdi/wcb4xxp/base.c
@@ -2492,7 +2492,8 @@ static void init_spans(struct b4xxp *b4)
sprintf(bspan->span.name, "B4/%d/%d", b4->cardno, i+1);
sprintf(bspan->span.desc, "B4XXP (PCI) Card %d Span %d", b4->cardno, i+1);
bspan->span.manufacturer = "Digium";
- dahdi_copy_string(bspan->span.devicetype, b4->variety, sizeof(bspan->span.devicetype));
+ strlcpy(bspan->span.devicetype, b4->variety,
+ sizeof(bspan->span.devicetype));
sprintf(bspan->span.location, "PCI Bus %02d Slot %02d",
b4->pdev->bus->number, PCI_SLOT(b4->pdev->devfn) + 1);
diff --git a/drivers/dahdi/wcfxo.c b/drivers/dahdi/wcfxo.c
index 78d0d33..d206512 100644
--- a/drivers/dahdi/wcfxo.c
+++ b/drivers/dahdi/wcfxo.c
@@ -654,7 +654,7 @@ static int wcfxo_initialize(struct wcfxo *wc)
snprintf(wc->span.location, sizeof(wc->span.location) - 1,
"PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.manufacturer = "Digium";
- dahdi_copy_string(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
+ strlcpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
wc->chan->sigcap = DAHDI_SIG_FXSKS | DAHDI_SIG_FXSLS | DAHDI_SIG_SF;
wc->chan->chanpos = 1;
wc->span.chans = &wc->chan;
diff --git a/drivers/dahdi/wct1xxp.c b/drivers/dahdi/wct1xxp.c
index 7173886..28c86a8 100644
--- a/drivers/dahdi/wct1xxp.c
+++ b/drivers/dahdi/wct1xxp.c
@@ -771,7 +771,7 @@ static int t1xxp_software_init(struct t1xxp *wc)
sprintf(wc->span.name, "WCT1/%d", wc->num);
snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Card %d", wc->variety, wc->num);
wc->span.manufacturer = "Digium";
- dahdi_copy_string(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
+ strlcpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
snprintf(wc->span.location, sizeof(wc->span.location) - 1,
"PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.irq = wc->dev->irq;
diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c
index eb6d04e..322a702 100644
--- a/drivers/dahdi/wct4xxp/base.c
+++ b/drivers/dahdi/wct4xxp/base.c
@@ -2016,7 +2016,8 @@ static void set_span_devicetype(struct t4 *wc)
for (x = 0; x < wc->numspans; x++) {
ts = wc->tspans[x];
- dahdi_copy_string(ts->span.devicetype, wc->variety, sizeof(ts->span.devicetype));
+ strlcpy(ts->span.devicetype, wc->variety,
+ sizeof(ts->span.devicetype));
if (wc->vpm == T4_VPM_PRESENT) {
if (!wc->vpm450m)
strncat(ts->span.devicetype, " (VPM400M)", sizeof(ts->span.devicetype) - 1);
diff --git a/drivers/dahdi/wctdm.c b/drivers/dahdi/wctdm.c
index c3c6d57..411795c 100644
--- a/drivers/dahdi/wctdm.c
+++ b/drivers/dahdi/wctdm.c
@@ -2370,7 +2370,7 @@ static int wctdm_initialize(struct wctdm *wc)
snprintf(wc->span.location, sizeof(wc->span.location) - 1,
"PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.manufacturer = "Digium";
- dahdi_copy_string(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
+ strlcpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
if (alawoverride) {
printk(KERN_INFO "ALAW override parameter detected. Device will be operating in ALAW\n");
wc->span.deflaw = DAHDI_LAW_ALAW;
diff --git a/drivers/dahdi/wcte11xp.c b/drivers/dahdi/wcte11xp.c
index 0da17aa..a0dbc79 100644
--- a/drivers/dahdi/wcte11xp.c
+++ b/drivers/dahdi/wcte11xp.c
@@ -978,7 +978,7 @@ static int t1xxp_software_init(struct t1 *wc)
sprintf(wc->span.name, "WCT1/%d", wc->num);
snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Card %d", wc->variety, wc->num);
wc->span.manufacturer = "Digium";
- dahdi_copy_string(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
+ strlcpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
snprintf(wc->span.location, sizeof(wc->span.location) - 1,
"PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.irq = wc->dev->irq;