kill sprintf

This commit is contained in:
christos 2014-03-25 16:19:13 +00:00
parent 1a3430eb55
commit 268d7559ce
24 changed files with 111 additions and 101 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_ndis.c,v 1.25 2014/03/23 02:55:26 christos Exp $ */
/* $NetBSD: kern_ndis.c,v 1.26 2014/03/25 16:23:58 christos Exp $ */
/*-
* Copyright (c) 2003
@ -37,7 +37,7 @@
__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.60.2.5 2005/04/01 17:14:20 wpaul Exp $");
#endif
#ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: kern_ndis.c,v 1.25 2014/03/23 02:55:26 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_ndis.c,v 1.26 2014/03/25 16:23:58 christos Exp $");
#endif
#include <sys/param.h>
@ -920,17 +920,18 @@ ndis_create_sysctls(void *arg)
"NDIS API Version", "0x00050001", CTLFLAG_RD);
/* Bus type (PCI, PCMCIA, etc...) */
sprintf(buf, "%d", (int)sc->ndis_iftype);
snprintf(buf, sizeof(buf), "%d", (int)sc->ndis_iftype);
ndis_add_sysctl(sc, "BusType", "Bus Type", buf, CTLFLAG_RD);
if (sc->ndis_res_io != NULL) {
sprintf(buf, "0x%lx", rman_get_start(sc->ndis_res_io));
snprintf(buf, sizeof(buf), "0x%lx",
rman_get_start(sc->ndis_res_io));
ndis_add_sysctl(sc, "IOBaseAddress",
"Base I/O Address", buf, CTLFLAG_RD);
}
if (sc->ndis_irq != NULL) {
sprintf(buf, "%lu", rman_get_start(sc->ndis_irq));
snprintf(buf, sizeof(buf), "%lu", rman_get_start(sc->ndis_irq));
ndis_add_sysctl(sc, "InterruptNumber",
"Interrupt Number", buf, CTLFLAG_RD);
}
@ -1015,17 +1016,18 @@ ndis_create_sysctls(void *arg)
/*"NDIS API Version"*/ "Version", "0x00050001", CTLFLAG_RD);
/* Bus type (PCI, PCMCIA, etc...) */
sprintf(buf, "%d", (int)sc->ndis_iftype);
snprintf(buf, sizeof(buf), "%d", (int)sc->ndis_iftype);
ndis_add_sysctl(sc, "BusType", "Bus Type", buf, CTLFLAG_RD);
if (sc->ndis_res_io != NULL) {
sprintf(buf, "0x%lx", (long unsigned int)rman_get_start(sc->ndis_res_io));
snprintf(buf, sizeof(buf), "0x%lx",
(long unsigned int)rman_get_start(sc->ndis_res_io));
ndis_add_sysctl(sc, "IOBaseAddress",
/*"Base I/O Address"*/ "Base I/O", buf, CTLFLAG_RD);
}
if (sc->ndis_irq != NULL) {
sprintf(buf, "%lu", (long unsigned int)rman_get_start(sc->ndis_irq));
snprintf(buf, sizeof(buf), "%lu", (long unsigned int)rman_get_start(sc->ndis_irq));
ndis_add_sysctl(sc, "InterruptNumber",
"Interrupt Number", buf, CTLFLAG_RD);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_ndis.c,v 1.27 2014/03/23 09:31:15 christos Exp $ */
/* $NetBSD: subr_ndis.c,v 1.28 2014/03/25 16:23:58 christos Exp $ */
/*-
* Copyright (c) 2003
@ -37,7 +37,7 @@
__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.67.2.7 2005/03/31 21:50:11 wpaul Exp $");
#endif
#ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: subr_ndis.c,v 1.27 2014/03/23 09:31:15 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_ndis.c,v 1.28 2014/03/25 16:23:58 christos Exp $");
#endif
/*
@ -160,7 +160,7 @@ __stdcall static void NdisOpenConfigurationKeyByName(ndis_status *,
static ndis_status ndis_encode_parm(ndis_miniport_block *,
struct sysctl_oid *, ndis_parm_type, ndis_config_parm **);
static ndis_status ndis_decode_parm(ndis_miniport_block *,
ndis_config_parm *, char *);
ndis_config_parm *, char *, size_t);
#else /* __NetBSD__ */
static ndis_status ndis_encode_parm(ndis_miniport_block *,
void *, ndis_parm_type, ndis_config_parm **);
@ -853,7 +853,8 @@ NdisReadConfiguration(ndis_status *status, ndis_config_parm **parm, ndis_handle
#ifdef __FreeBSD__
static ndis_status
ndis_decode_parm(ndis_miniport_block *block, ndis_config_parm *parm, char *val)
ndis_decode_parm(ndis_miniport_block *block, ndis_config_parm *parm, char *val,
size_t len)
{
ndis_unicode_string *ustr;
char *astr = NULL;
@ -868,10 +869,10 @@ ndis_decode_parm(ndis_miniport_block *block, ndis_config_parm *parm, char *val)
free(astr, M_DEVBUF);
break;
case ndis_parm_int:
sprintf(val, "%d", parm->ncp_parmdata.ncp_intdata);
snprintf(val, len, "%d", parm->ncp_parmdata.ncp_intdata);
break;
case ndis_parm_hexint:
sprintf(val, "%xu", parm->ncp_parmdata.ncp_intdata);
snprintf(val, len, "%xu", parm->ncp_parmdata.ncp_intdata);
break;
default:
return(NDIS_STATUS_FAILURE);
@ -910,7 +911,7 @@ NdisWriteConfiguration(
/* Decode the parameter into a string. */
memset(val, 0, sizeof(val));
*status = ndis_decode_parm(block, parm, val);
*status = ndis_decode_parm(block, parm, val, sizeof(val));
if (*status != NDIS_STATUS_SUCCESS) {
free(keystr, M_DEVBUF);
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_ntoskrnl.c,v 1.23 2014/03/23 09:31:15 christos Exp $ */
/* $NetBSD: subr_ntoskrnl.c,v 1.24 2014/03/25 16:23:58 christos Exp $ */
/*-
* Copyright (c) 2003
@ -37,7 +37,7 @@
__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ntoskrnl.c,v 1.43.2.5 2005/03/31 04:24:36 wpaul Exp $");
#endif
#ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: subr_ntoskrnl.c,v 1.23 2014/03/23 09:31:15 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_ntoskrnl.c,v 1.24 2014/03/25 16:23:58 christos Exp $");
#endif
#ifdef __FreeBSD__
@ -2384,7 +2384,7 @@ PsCreateSystemThread(
tc->tc_thrctx = thrctx;
tc->tc_thrfunc = thrfunc;
sprintf(tname, "windows kthread %d", ntoskrnl_kth);
snprintf(tname, sizeof(tname), "windows kthread %d", ntoskrnl_kth);
#ifdef __FreeBSD__
error = kthread_create(ntoskrnl_thrfunc, tc, &p,
RFHIGHPID, NDIS_KSTACK_PAGES, tname);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ata_raid_intel.c,v 1.6 2010/07/06 18:09:04 bsh Exp $ */
/* $NetBSD: ata_raid_intel.c,v 1.7 2014/03/25 16:19:13 christos Exp $ */
/*-
* Copyright (c) 2000-2008 Søren Schmidt <sos@FreeBSD.org>
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ata_raid_intel.c,v 1.6 2010/07/06 18:09:04 bsh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ata_raid_intel.c,v 1.7 2014/03/25 16:19:13 christos Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -79,7 +79,7 @@ ata_raid_intel_type(int type)
case INTEL_T_RAID5:
return "RAID5";
default:
sprintf(buffer, "UNKNOWN 0x%02x", type);
snprintf(buffer, sizeof(buffer), "UNKNOWN 0x%02x", type);
return buffer;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ata_raid_jmicron.c,v 1.4 2009/05/11 17:14:31 cegger Exp $ */
/* $NetBSD: ata_raid_jmicron.c,v 1.5 2014/03/25 16:19:13 christos Exp $ */
/*-
* Copyright (c) 2000-2008 Søren Schmidt <sos@FreeBSD.org>
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ata_raid_jmicron.c,v 1.4 2009/05/11 17:14:31 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: ata_raid_jmicron.c,v 1.5 2014/03/25 16:19:13 christos Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -82,7 +82,7 @@ ata_raid_jmicron_type(int type)
case JM_T_JBOD:
return "JBOD";
default:
sprintf(buffer, "UNKNOWN 0x%02x", type);
snprintf(buffer, sizeof(buffer), "UNKNOWN 0x%02x", type);
return buffer;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ata_raid_nvidia.c,v 1.1 2008/08/20 15:00:34 tacha Exp $ */
/* $NetBSD: ata_raid_nvidia.c,v 1.2 2014/03/25 16:19:13 christos Exp $ */
/*-
* Copyright (c) 2000 - 2008 Søren Schmidt <sos@FreeBSD.org>
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ata_raid_nvidia.c,v 1.1 2008/08/20 15:00:34 tacha Exp $");
__KERNEL_RCSID(0, "$NetBSD: ata_raid_nvidia.c,v 1.2 2014/03/25 16:19:13 christos Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -76,7 +76,7 @@ ata_raid_nvidia_type(int type)
case NV_T_RAID5: return "RAID5";
case NV_T_RAID01: return "RAID0+1";
default:
sprintf(buffer, "UNKNOWN 0x%02x", type);
snprintf(buffer, sizeof(buffer), "UNKNOWN 0x%02x", type);
return buffer;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ata_raid_via.c,v 1.6 2008/09/19 16:49:27 christos Exp $ */
/* $NetBSD: ata_raid_via.c,v 1.7 2014/03/25 16:19:13 christos Exp $ */
/*-
* Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org>
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ata_raid_via.c,v 1.6 2008/09/19 16:49:27 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ata_raid_via.c,v 1.7 2014/03/25 16:19:13 christos Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -71,13 +71,13 @@ ata_raid_via_type(int type)
static char buffer[16];
switch (type) {
case VIA_T_RAID0: return "RAID0";
case VIA_T_RAID1: return "RAID1";
case VIA_T_RAID5: return "RAID5";
case VIA_T_RAID01: return "RAID0+1";
case VIA_T_SPAN: return "SPAN";
default:
sprintf(buffer, "UNKNOWN 0x%02x", type);
case VIA_T_RAID0: return "RAID0";
case VIA_T_RAID1: return "RAID1";
case VIA_T_RAID5: return "RAID5";
case VIA_T_RAID01: return "RAID0+1";
case VIA_T_SPAN: return "SPAN";
default:
snprintf(buffer, sizeof(buffer), "UNKNOWN 0x%02x", type);
return buffer;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: firmload.c,v 1.18 2014/02/25 18:30:09 pooka Exp $ */
/* $NetBSD: firmload.c,v 1.19 2014/03/25 16:19:13 christos Exp $ */
/*-
* Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: firmload.c,v 1.18 2014/02/25 18:30:09 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: firmload.c,v 1.19 2014/03/25 16:19:13 christos Exp $");
/*
* The firmload API provides an interface for device drivers to access
@ -185,11 +185,8 @@ firmware_path_next(const char *drvname, const char *imgname, char *pnbuf,
prefix++;
*prefixp = prefix;
/*
* This sprintf() is safe because of the maxprefix calculation
* performed above.
*/
sprintf(&pnbuf[i], "/%s/%s", drvname, imgname);
KASSERT(MAXPATHLEN >= i);
snprintf(pnbuf + i, MAXPATHLEN - i, "/%s/%s", drvname, imgname);
return (pnbuf);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ncr53c9xvar.h,v 1.55 2011/07/31 18:39:00 jakllsch Exp $ */
/* $NetBSD: ncr53c9xvar.h,v 1.56 2014/03/25 16:19:13 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -130,9 +130,10 @@ struct ncr53c9x_ecb {
#if NCR53C9X_DEBUG > 1
#define ECB_TRACE(ecb, msg, a, b) do { \
const char *f = "[" msg "]"; \
int n = strlen((ecb)->trace); \
if (n < (sizeof((ecb)->trace)-100)) \
sprintf((ecb)->trace + n, f, a, b); \
size_t n = strlen((ecb)->trace); \
if (n >= (sizeof((ecb)->trace)-100)) \
break; \
snprintf((ecb)->trace + n, sizeof((ecb)->trace) - n, f, a, b); \
} while(0)
#else
#define ECB_TRACE(ecb, msg, a, b)

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunscpal.c,v 1.25 2009/11/23 02:13:46 rmind Exp $ */
/* $NetBSD: sunscpal.c,v 1.26 2014/03/25 16:19:13 christos Exp $ */
/*
* Copyright (c) 2001 Matthew Fredette
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sunscpal.c,v 1.25 2009/11/23 02:13:46 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: sunscpal.c,v 1.26 2014/03/25 16:19:13 christos Exp $");
#include "opt_ddb.h"
@ -725,7 +725,6 @@ sunscpal_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
void *arg)
{
struct scsipi_xfer *xs;
struct scsipi_periph *periph;
struct sunscpal_softc *sc;
struct sunscpal_req *sr;
int s, i, flags;
@ -735,7 +734,6 @@ sunscpal_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
switch (req) {
case ADAPTER_REQ_RUN_XFER:
xs = arg;
periph = xs->xs_periph;
flags = xs->xs_control;
if (flags & XS_CTL_DATA_UIO)

View File

@ -28,7 +28,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cxgb_l2t.c,v 1.2 2013/01/23 23:31:26 joerg Exp $");
__KERNEL_RCSID(0, "$NetBSD: cxgb_l2t.c,v 1.3 2014/03/25 16:19:14 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -635,7 +635,7 @@ l2t_seq_show(struct seq_file *seq, void *v)
struct l2t_entry *e = v;
mtx_lock(&e->lock);
sprintf(ip, "%u.%u.%u.%u", NIPQUAD(e->addr));
snprintf(ip, sizeof(ip), "%u.%u.%u.%u", NIPQUAD(e->addr));
seq_printf(seq, "%-5u %-15s %02x:%02x:%02x:%02x:%02x:%02x %4d"
" %3u %c %7u %4u %s\n",
e->idx, ip, e->dmac[0], e->dmac[1], e->dmac[2],

View File

@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cxgb_offload.c,v 1.2 2011/05/18 01:01:59 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: cxgb_offload.c,v 1.3 2014/03/25 16:19:14 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1565,7 +1565,7 @@ offload_info_read_proc(char *buf, char **start, off_t offset,
struct tid_info *t = &d->tid_maps;
int len;
len = sprintf(buf, "TID range: 0..%d, in use: %u\n"
len = snprintf(buf, length, "TID range: 0..%d, in use: %u\n"
"STID range: %d..%d, in use: %u\n"
"ATID range: %d..%d, in use: %u\n"
"MSS: %u\n",
@ -1605,20 +1605,25 @@ offload_devices_read_proc(char *buf, char **start, off_t offset,
struct toedev *dev;
struct net_device *ndev;
len = sprintf(buf, "Device Interfaces\n");
len = snprintf(buf, length, "Device Interfaces\n");
mtx_lock(&cxgb_db_lock);
TAILQ_FOREACH(dev, &ofld_dev_list, ofld_entry) {
len += sprintf(buf + len, "%-16s", dev->name);
if (len >= length)
break;
len += snprintf(buf + len, length - len, "%-16s", dev->name);
read_lock(&dev_base_lock);
for (ndev = dev_base; ndev; ndev = ndev->next) {
if (TOEDEV(ndev) == dev)
len += sprintf(buf + len, " %s", ndev->name);
if (TOEDEV(ndev) == dev) {
if (len >= length)
break;
len += snprintf(buf + len, length - len, " %s", ndev->name);
}
}
read_unlock(&dev_base_lock);
len += sprintf(buf + len, "\n");
if (len >= length)
break;
len += snprintf(buf + len, length - len, "\n");
}
mtx_unlock(&cxgb_db_lock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hdafg.c,v 1.18 2013/10/16 18:13:00 christos Exp $ */
/* $NetBSD: hdafg.c,v 1.19 2014/03/25 16:19:14 christos Exp $ */
/*
* Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk>
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.18 2013/10/16 18:13:00 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.19 2014/03/25 16:19:14 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -2944,7 +2944,8 @@ hdafg_build_mixers(struct hdafg_softc *sc)
if (sc->sc_assocs[i].as_dir != HDAUDIO_PINDIR_OUT)
continue;
mx[index].mx_di.un.s.member[j].mask = 1 << i;
sprintf(mx[index].mx_di.un.s.member[j].label.name,
snprintf(mx[index].mx_di.un.s.member[j].label.name,
sizeof(mx[index].mx_di.un.s.member[j].label.name),
"%s%02X",
hdafg_assoc_type_string(&sc->sc_assocs[i]), i);
++j;
@ -2967,7 +2968,8 @@ hdafg_build_mixers(struct hdafg_softc *sc)
if (sc->sc_assocs[i].as_dir != HDAUDIO_PINDIR_IN)
continue;
mx[index].mx_di.un.s.member[j].mask = 1 << i;
sprintf(mx[index].mx_di.un.s.member[j].label.name,
snprintf(mx[index].mx_di.un.s.member[j].label.name,
sizeof(mx[index].mx_di.un.s.member[j].label.name),
"%s%02X",
hdafg_assoc_type_string(&sc->sc_assocs[i]), i);
++j;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_kse.c,v 1.25 2013/11/08 06:20:48 nisimura Exp $ */
/* $NetBSD: if_kse.c,v 1.26 2014/03/25 16:19:13 christos Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.25 2013/11/08 06:20:48 nisimura Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.26 2014/03/25 16:19:13 christos Exp $");
#include <sys/param.h>
@ -530,7 +530,8 @@ kse_attach(device_t parent, device_t self, void *aux)
int p = (sc->sc_chip == 0x8842) ? 3 : 1;
for (i = 0; i < p; i++) {
struct ksext *ee = &sc->sc_ext;
sprintf(ee->evcntname[i], "%s.%d", device_xname(sc->sc_dev), i+1);
snprintf(ee->evcntname[i], sizeof(ee->evcntname[i]),
"%s.%d", device_xname(sc->sc_dev), i+1);
evcnt_attach_dynamic(&ee->pev[i][0], EVCNT_TYPE_MISC,
NULL, ee->evcntname[i], "RxLoPriotyByte");
evcnt_attach_dynamic(&ee->pev[i][1], EVCNT_TYPE_MISC,

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_wm.c,v 1.266 2014/01/07 13:14:39 msaitoh Exp $ */
/* $NetBSD: if_wm.c,v 1.267 2014/03/25 16:19:13 christos Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.266 2014/01/07 13:14:39 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.267 2014/03/25 16:19:13 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -2094,7 +2094,8 @@ wm_attach(device_t parent, device_t self, void *aux)
NULL, xname, "txtsopain");
for (i = 0; i < WM_NTXSEGS; i++) {
sprintf(wm_txseg_evcnt_names[i], "txseg%d", i);
snprintf(wm_txseg_evcnt_names[i],
sizeof(wm_txseg_evcnt_names[i]), "txseg%d", i);
evcnt_attach_dynamic(&sc->sc_ev_txseg[i], EVCNT_TYPE_MISC,
NULL, xname, wm_txseg_evcnt_names[i]);
}

View File

@ -31,7 +31,7 @@
******************************************************************************/
/*$FreeBSD: src/sys/dev/ixgbe/ixv.c,v 1.2 2011/03/23 13:10:15 jhb Exp $*/
/*$NetBSD: ixv.c,v 1.1 2011/08/12 21:55:29 dyoung Exp $*/
/*$NetBSD: ixv.c,v 1.2 2014/03/25 16:19:14 christos Exp $*/
#include "opt_inet.h"
@ -269,9 +269,9 @@ ixv_probe(device_t dev)
((pci_subdevice_id == ent->subdevice_id) ||
(ent->subdevice_id == 0))) {
sprintf(adapter_name, "%s, Version - %s",
ixv_strings[ent->index],
ixv_driver_version);
snprintf(adapter_name, sizeof(adapter_name),
"%s, Version - %s", ixv_strings[ent->index],
ixv_driver_version);
device_set_desc_copy(dev, adapter_name);
return (0);
}

View File

@ -32,7 +32,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
static char const n8_id[] = "$Id: n8_callback.c,v 1.1 2008/10/30 12:02:14 darran Exp $";
static char const n8_id[] = "$Id: n8_callback.c,v 1.2 2014/03/25 16:19:14 christos Exp $";
/*****************************************************************************/
/** @file n8_callback.c
* @brief Routines for implementing the API callbacks.
@ -188,7 +188,7 @@ N8_Status_t n8_callbackThread(N8_CallbackData_t *callbackData_p)
recalc_sigpending(current);
/* set name of this process (max 15 chars + 0 !) */
sprintf(current->comm, "NSP2000 Thread");
strcpy(current->comm, "NSP2000 Thread");
#endif
while (callbackData_p->n8_thread == TRUE)

View File

@ -32,7 +32,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
static char const n8_id[] = "$Id: n8_daemon_sks.c,v 1.1 2008/10/30 12:02:14 darran Exp $";
static char const n8_id[] = "$Id: n8_daemon_sks.c,v 1.2 2014/03/25 16:19:14 christos Exp $";
/*****************************************************************************/
/** @file n8_daemon_sks.c
* @brief This file implements the user side of the daemon's SKS
@ -233,8 +233,7 @@ N8_Status_t n8_daemon_sks_write(N8_SKSKeyHandle_t *sks_key_p,
* we don't terminate it with '/'. This is because on BSDi
* you can't create a directory whose name appended with '/'
*/
sprintf(sub_dir, "%s%i",
SKS_KEY_NODE_PATH,
snprintf(sub_dir, sizeof(sub_dir), "%s%i", SKS_KEY_NODE_PATH,
sks_key_p->unitID);
if ((dir_p = opendir(sub_dir)) == NULL)
@ -258,7 +257,7 @@ N8_Status_t n8_daemon_sks_write(N8_SKSKeyHandle_t *sks_key_p,
}
/* build full path name for key handle file */
sprintf(key_entry, "%s%i/%s",
snprintf(key_entry, sizeof(key_entry), "%s%i/%s",
SKS_KEY_NODE_PATH,
sks_key_p->unitID,
key_entry_name);
@ -438,8 +437,8 @@ N8_Status_t n8_daemon_sks_init(N8_Unit_t targetSKS,
/* Open the SKS entry directory. Read all the key files and
* allocate descriptor space for them.
*/
sprintf(sks_entry_name, "%s%i/", SKS_KEY_NODE_PATH,
targetSKS);
snprintf(sks_entry_name, sizeof(sks_entry_name), "%s%i/",
SKS_KEY_NODE_PATH, targetSKS);
DBG(("Target sks dev node is '%s'.\n\n", sks_entry_name));
@ -461,7 +460,7 @@ N8_Status_t n8_daemon_sks_init(N8_Unit_t targetSKS,
if ((strcmp(dirent_p->d_name, ".") != 0) &&
(strcmp(dirent_p->d_name, "..") != 0))
{
sprintf(sks_entry, "%s%s", sks_entry_name,
snprintf(sks_entry, sizeof(sks_entry), "%s%s", sks_entry_name,
dirent_p->d_name);
ret = n8_daemon_sks_read(&keyHandle,
@ -521,7 +520,8 @@ N8_Status_t n8_daemon_sks_reset(N8_Unit_t targetSKS)
N8_Status_t ret = N8_STATUS_OK;
DBG(("Reset :\n"));
sprintf(key_entry, "%s%i/", SKS_KEY_NODE_PATH, targetSKS);
snprintf(key_entry, sizeof(key_entry), "%s%i/",
SKS_KEY_NODE_PATH, targetSKS);
/* Find out which, if any, key entries exist. Then blast 'em. */
DBG(("Resetting SKS %i.\n", targetSKS));
@ -557,7 +557,7 @@ N8_Status_t n8_daemon_sks_reset(N8_Unit_t targetSKS)
}
DBG(("%s : \n", dirent_p->d_name));
sprintf(key_entry_path, "%s%i/%s",
snprintf(key_entry_path, sizeof(key_entry_path), "%s%i/%s",
SKS_KEY_NODE_PATH,
targetSKS,
dirent_p->d_name);

View File

@ -32,7 +32,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
static char const n8_id[] = "$Id: n8_sks.c,v 1.2 2011/08/01 12:28:54 mbalmer Exp $";
static char const n8_id[] = "$Id: n8_sks.c,v 1.3 2014/03/25 16:19:14 christos Exp $";
/*****************************************************************************/
/** @file SKS_Management_Interface
* @brief Implementation for the SKS Management Interface.
@ -379,7 +379,7 @@ void n8_printSKSKeyHandle(const N8_SKSKeyHandle_t *keyHandle_p)
* The given key handle pointer is valid.
*****************************************************************************/
N8_Status_t N8_SKSDisplay(N8_SKSKeyHandle_t *keyHandle_p,
char *display_string_p)
char *display_string_p, size_t len)
{
if (keyHandle_p == NULL)
{
@ -391,7 +391,7 @@ N8_Status_t N8_SKSDisplay(N8_SKSKeyHandle_t *keyHandle_p,
return N8_INVALID_PARAMETER;
}
sprintf(display_string_p,
snprintf(display_string_p, len,
"Key Handle:\n"
"\tKey Type %08x\n"
"\tKey Length %08x\n"

View File

@ -32,7 +32,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
static char const n8_id[] = "$Id: n8_system.c,v 1.1 2008/10/30 12:02:15 darran Exp $";
static char const n8_id[] = "$Id: n8_system.c,v 1.2 2014/03/25 16:19:14 christos Exp $";
/*****************************************************************************/
/** @file n8_system.c
* @brief Implements the API call N8_GetSystemParameter, which allows users to
@ -71,7 +71,7 @@ static N8_Status_t setHWrevision(N8_Buffer_t *value_p);
static N8_Status_t setSWversion(N8_Buffer_t *value_p);
static N8_Status_t setContextSize(N8_Buffer_t *value_p);
static N8_Status_t setSKSsize(N8_Buffer_t *value_p);
static N8_Status_t setSWversionText(N8_Buffer_t *value_p);
static N8_Status_t setSWversionText(N8_Buffer_t *value_p, size_t value_l);
static N8_Status_t setFD(N8_Buffer_t *value_p);
static N8_Status_t setInitInfo(N8_Buffer_t *value_p);
@ -104,7 +104,8 @@ extern NSPdriverInfo_t nspDriverInfo;
* @par Assumptions
* None<br>
*****************************************************************************/
N8_Status_t N8_GetSystemParameter(N8_Parameter_t parameter, void *value_p)
N8_Status_t N8_GetSystemParameter(N8_Parameter_t parameter, void *value_p,
size_t value_l)
{
N8_Status_t ret = N8_STATUS_OK;
@ -156,7 +157,7 @@ N8_Status_t N8_GetSystemParameter(N8_Parameter_t parameter, void *value_p)
ret = setNumberOfChips(value_p);
break;
case N8_SWVERSIONTEXT:
ret = setSWversionText(value_p);
ret = setSWversionText(value_p, value_l);
break;
case N8_INITIALIZE_INFO:
ret = setInitInfo(value_p);
@ -685,9 +686,9 @@ static N8_Status_t setNumberOfChips(N8_Buffer_t *value_p)
* @par Assumptions
* None<br>
*****************************************************************************/
N8_Status_t setSWversionText(N8_Buffer_t *value_p)
N8_Status_t setSWversionText(N8_Buffer_t *value_p, size_t value_l)
{
sprintf(value_p, N8_VERSION_STRING);
snprintf(value_p, value_l, N8_VERSION_STRING);
return N8_STATUS_OK;
} /* setSWversionText */

View File

@ -134,7 +134,7 @@ typedef enum
/*****************************************************************************
* Function prototypes
*****************************************************************************/
N8_Status_t N8_GetSystemParameter(N8_Parameter_t parameter, void *value_p);
N8_Status_t N8_GetSystemParameter(N8_Parameter_t parameter, void *value_p, size_t value_l);
N8_Status_t N8_InitializeAPI(N8_ConfigAPI_t *parameters_p);
N8_Status_t N8_EventCheck(N8_Event_t *events_p, const int count, int *ready_p);
N8_Status_t N8_EventWait (N8_Event_t *events_p, const int count, int *ready_p);

View File

@ -76,7 +76,7 @@ N8_Status_t N8_SKSGetKeyHandle(const N8_Buffer_t* keyEntryName,
N8_SKSKeyHandle_t* keyHandle_p);
N8_Status_t N8_SKSDisplay(N8_SKSKeyHandle_t* keyHandle,
char string[1024]);
char *string, size_t stringlength);
#ifdef __cplusplus
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_disks.c,v 1.84 2013/09/15 12:44:03 martin Exp $ */
/* $NetBSD: rf_disks.c,v 1.85 2014/03/25 16:19:14 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@ -60,7 +60,7 @@
***************************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.84 2013/09/15 12:44:03 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.85 2014/03/25 16:19:14 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@ -594,7 +594,8 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, char *bf, RF_RaidDisk_t *diskPtr,
if (!strcmp("absent", diskPtr->devname)) {
printf("Ignoring missing component at column %d\n", col);
sprintf(diskPtr->devname, "component%d", col);
snprintf(diskPtr->devname, sizeof(diskPtr->devname),
"component%d", col);
diskPtr->status = rf_ds_failed;
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_general.h,v 1.20 2013/09/15 12:06:50 martin Exp $ */
/* $NetBSD: rf_general.h,v 1.21 2014/03/25 16:19:14 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -41,7 +41,7 @@
/* error reporting and handling */
#include <sys/systm.h> /* printf, sprintf, and friends */
#include <sys/systm.h> /* printf, snprintf, and friends */
#define RF_ERRORMSG(s) printf((s))
#define RF_ERRORMSG1(s,a) printf((s),(a))