From: David van Moolenbroek Date: Fri, 3 Aug 2012 15:48:54 +0000 (+0000) Subject: dpeth: resolve Coverity warnings X-Git-Tag: v3.2.1~409 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=6199f090c8ded2cca90bf8a3bf4cfdb585f01960;p=minix.git dpeth: resolve Coverity warnings --- diff --git a/drivers/dpeth/dp.c b/drivers/dpeth/dp.c index 240bc0c4b..818d3d181 100644 --- a/drivers/dpeth/dp.c +++ b/drivers/dpeth/dp.c @@ -87,7 +87,7 @@ static void dp_confaddr(dpeth_t * dep) int ix; long val; - strcpy(ea_key, "DPETH0_EA"); + strlcpy(ea_key, "DPETH0_EA", sizeof(ea_key)); ea_key[5] += de_instance; for (ix = 0; ix < SA_ADDR_LEN; ix++) { @@ -114,7 +114,7 @@ static void update_conf(dpeth_t * dep, const dp_conf_t * dcp) char ec_key[16]; long val; - strcpy(ec_key, "DPETH0"); + strlcpy(ec_key, "DPETH0", sizeof(ec_key)); ec_key[5] += de_instance; dep->de_mode = DEM_SINK; @@ -216,7 +216,8 @@ static void do_first_init(dpeth_t *dep, const dp_conf_t *dcp) * automatically. Return the IRQ line number when an interrupt occurs. */ dep->de_hook = dep->de_irq; - sys_irqsetpolicy(dep->de_irq, 0 /*IRQ_REENABLE*/, &dep->de_hook); + if (sys_irqsetpolicy(dep->de_irq, 0 /*IRQ_REENABLE*/, &dep->de_hook) != OK) + panic("unable to set IRQ policy"); dep->de_int_pending = FALSE; sys_irqenable(&dep->de_hook); @@ -241,7 +242,7 @@ static void do_init(const message * mp) confnr = MIN(de_instance, DP_CONF_NR-1); dcp = &dp_conf[confnr]; - strcpy(dep->de_name, DevName); + strlcpy(dep->de_name, DevName, sizeof(dep->de_name)); dep->de_name[4] = '0' + de_instance; if (dep->de_mode == DEM_DISABLED) {