ipspkernfs_len = k + 1;
ipsp_kern(int off, char **bufp, int len){    struct tdb *tdbp;    int i, k;    char *b;    if (off != 0)      return 0;    if ((!ipspkernfs_dirty) && (ipspkernfs))    {	*bufp = ipspkernfs;	return ipspkernfs_len;    }    else      ipspkernfs_dirty = 0;    if (ipspkernfs)    {      	FREE(ipspkernfs, M_XDATA);	ipspkernfs = NULL;    }    for (i = 0, k = 0; i < TDB_HASHMOD; i++)      for (tdbp = tdbh[i]; tdbp != (struct tdb *) NULL; tdbp = tdbp->tdb_hnext)      {	  /* Being paranoid to avoid buffer overflows */          k += 126 + strlen(tdbp->tdb_xform->xf_name);          if (tdbp->tdb_rcvif)            k += strlen(tdbp->tdb_rcvif->if_xname);          else            k += 4;      }    if (k == 0)      return 0;    MALLOC(ipspkernfs, char *, k + 1, M_XDATA, M_DONTWAIT);    if (!ipspkernfs)      return 0;    ipspkernfs_len = k + 1;    for (i = 0, k = 0; i < TDB_HASHMOD; i++)      for (tdbp = tdbh[i]; tdbp != (struct tdb *) NULL; tdbp = tdbp->tdb_hnext)      {	  b = (char *)&(tdbp->tdb_dst.s_addr);	  k += sprintf(ipspkernfs + k, 		"SPI=%x, destination=%d.%d.%d.%d, interface=%s\n algorithm=%d (%s)\n next SPI=%x, previous SPI=%x\n", 		ntohl(tdbp->tdb_spi), ((int)b[0] & 0xff), ((int)b[1] & 0xff), 		((int)b[2] & 0xff), ((int)b[3] & 0xff), 		(tdbp->tdb_rcvif ? tdbp->tdb_rcvif->if_xname : "none"),		tdbp->tdb_xform->xf_type, tdbp->tdb_xform->xf_name,		(tdbp->tdb_onext ? ntohl(tdbp->tdb_onext->tdb_spi) : 0),		(tdbp->tdb_inext ? ntohl(tdbp->tdb_inext->tdb_spi) : 0));      }    ipspkernfs[k] = '\0';    *bufp = ipspkernfs;    return ipspkernfs_len;}