arch/: unitialized vars

2013-06-28 Thread Maxime Villard
Hi,
some other uninitialized vars found by my scanner in arch/.

== hp300/dev/hd.c
At l.544, 'error' is not initialized.
== luna88k/luna88k/autoconf.c
At l.132, 'c' may be uninitialized.
== mips64/mips64/cache_tfp.c
At l.109, 'eva' is not initialized.
== sparc/dev/zs.c
At l.513, 'tmp' may be uninitialized.
== sparc64/dev/vdsp.c
At l.384, 'err' may be uninitialized. This variable should
be the return value of hv_ldc_tx_get_state(), see l.417.
== zaurus/dev/vdsp.c
At l.897, 'parity' is not initialized.



Re: arch/: unitialized vars

2013-06-28 Thread Janne Johansson
Now the hard part is to figure out exactly where it should have been
initialized and to what. Just setting it to 0 somewhere is not necessarily
better.



2013/6/28 Maxime Villard 

> Hi,
> some other uninitialized vars found by my scanner in arch/.
>
> == hp300/dev/hd.c
> At l.544, 'error' is not initialized.
> == luna88k/luna88k/autoconf.c
> At l.132, 'c' may be uninitialized.
> == mips64/mips64/cache_tfp.c
> At l.109, 'eva' is not initialized.
> == sparc/dev/zs.c
> At l.513, 'tmp' may be uninitialized.
> == sparc64/dev/vdsp.c
> At l.384, 'err' may be uninitialized. This variable should
> be the return value of hv_ldc_tx_get_state(), see l.417.
> == zaurus/dev/vdsp.c
> At l.897, 'parity' is not initialized.
>
>


-- 
May the most significant bit of your life be positive.


Re: arch/: unitialized vars

2013-06-28 Thread Jasper Lievisse Adriaanse
On Fri, Jun 28, 2013 at 09:11:13AM +0200, Janne Johansson wrote:
> Now the hard part is to figure out exactly where it should have been
> initialized and to what. Just setting it to 0 somewhere is not necessarily
> better.
It seems the mips64/mips64/cache_tfp.c one is a proper bug. Looking at the
caching routines for the r10k, I'd propose this (untested):

Index: cache_tfp.c
===
RCS file: /cvs/src/sys/arch/mips64/mips64/cache_tfp.c,v
retrieving revision 1.1
diff -p -u -r1.1 cache_tfp.c
--- cache_tfp.c 29 Sep 2012 21:37:03 -  1.1
+++ cache_tfp.c 28 Jun 2013 07:16:38 -
@@ -106,6 +106,7 @@ tfp_SyncCache(struct cpu_info *ci)
 
sr = disableintr();
va = ci->ci_l1datacachesize;
+   eva = va + ci->ci_l1instcacheset;
for (va = 0; va < eva; va += TFP_DCTW_STEP)
tfp_dctw_zero(va);
setsr(sr);

But I reckon Miod would be able to a conclusive answer here.

> 2013/6/28 Maxime Villard 
> 
> > Hi,
> > some other uninitialized vars found by my scanner in arch/.
> >
> > == hp300/dev/hd.c
> > At l.544, 'error' is not initialized.
> > == luna88k/luna88k/autoconf.c
> > At l.132, 'c' may be uninitialized.
> > == mips64/mips64/cache_tfp.c
> > At l.109, 'eva' is not initialized.
> > == sparc/dev/zs.c
> > At l.513, 'tmp' may be uninitialized.
> > == sparc64/dev/vdsp.c
> > At l.384, 'err' may be uninitialized. This variable should
> > be the return value of hv_ldc_tx_get_state(), see l.417.
> > == zaurus/dev/vdsp.c
> > At l.897, 'parity' is not initialized.
> >
> >
> 
> 
> -- 
> May the most significant bit of your life be positive.

-- 
Cheers,
Jasper

"Stay Hungry. Stay Foolish"



Re: Fix for IPMI temperature sensor status

2013-06-28 Thread Matthias Pitzl
Hi,

So far i got no comments if this fix is ok or not.
Is there any better way to do the comparison without just casting the values to
int8_t?

Greetings,
Matthias



relayd patch; persistence for multiple listen on

2013-06-28 Thread Anders Berggren
We experienced a "quirk" with persistence and multiple listen addresses on 
redirects, such as listening to both port 21 and a passive port range for load 
balancing FTP, because the session's stickiness seems to operate per-pass-rule. 
One solution would be group all rules as matches under one pass. The following 
diff is a bit rough, but applies to current (with a little fuzz). I submit it 
so that you can reflect upon it. 

--- pfe_filter.c.orig   Wed Nov 14 09:31:47 2012
+++ pfe_filter.cWed Nov 14 16:09:47 2012
@@ -395,11 +395,20 @@
return;
}

+   /* In case we have multiple >listen on< we need to aggregate them into 
one policy which does
+* the rdr-to (this makes stat counters and src-tracking work for 
mulit-port protocols).
+* eg. 21 and passive ftp ports (5:50500).
+*
+* match 
+* match 
+* pass ... rdr-to 
+*/
+   int multiple_listen = TAILQ_NEXT(TAILQ_FIRST(&rdr->virts), entry) != 
NULL;
TAILQ_FOREACH(address, &rdr->virts, entry) {
memset(&rio, 0, sizeof(rio));
(void)strlcpy(rio.anchor, anchor, sizeof(rio.anchor));

-   if (rdr->conf.flags & F_MATCH) {
+   if (rdr->conf.flags & F_MATCH || multiple_listen) {
rio.rule.action = PF_MATCH;
rio.rule.quick = 0;
} else {
@@ -444,7 +453,10 @@
rio.rule.timeout[PFTM_TCP_ESTABLISHED] =
rdr->conf.timeout.tv_sec;

-   if (strlen(rdr->conf.tag))
+   if (multiple_listen)
+   (void)strlcpy(rio.rule.tagname, anchor,
+   sizeof(rio.rule.tagname));
+   else if (strlen(rdr->conf.tag))
(void)strlcpy(rio.rule.tagname, rdr->conf.tag,
sizeof(rio.rule.tagname));
if (strlen(address->ifname))
@@ -467,6 +479,9 @@
}

rio.rule.nat.addr.type = PF_ADDR_NONE;
+   if (multiple_listen)
+   rio.rule.rdr.addr.type = PF_ADDR_NONE;
+   else {
rio.rule.rdr.addr.type = PF_ADDR_TABLE;
if (strlen(t->conf.ifname))
(void)strlcpy(rio.rule.rdr.ifname, t->conf.ifname,
@@ -491,6 +506,68 @@
   sizeof(rio.rule.route));
rio.rule.rdr.addr.type = PF_ADDR_NONE;
}
+   }
+
+   rio.rule.prio[0] = PF_PRIO_NOTSET;
+   rio.rule.prio[1] = PF_PRIO_NOTSET;
+
+   if (ioctl(env->sc_pf->dev, DIOCADDRULE, &rio) == -1)
+   fatal("cannot add rule");
+   log_debug("%s: rule added to anchor \"%s\"", __func__, anchor);
+   }
+   if (multiple_listen) {
+   memset(&rio, 0, sizeof(rio));
+   (void)strlcpy(rio.anchor, anchor, sizeof(rio.anchor));
+
+   if (rdr->conf.flags & F_MATCH) {
+   rio.rule.action = PF_MATCH;
+   rio.rule.quick = 0;
+   } else {
+   rio.rule.action = PF_PASS;
+   rio.rule.quick = 1; /* force first match */
+   }
+   rio.rule.direction = PF_IN;
+   rio.rule.keep_state = PF_STATE_NORMAL;
+   rio.ticket = env->sc_pf->pfte.ticket;
+   rio.rule.af = 0;
+   rio.rule.proto = 0;
+   rio.rule.src.addr.type = PF_ADDR_ADDRMASK;
+   rio.rule.dst.addr.type = PF_ADDR_ADDRMASK;
+   rio.rule.dst.port_op = PF_OP_NONE;
+   rio.rule.rtableid = -1;
+   (void)strlcpy(rio.rule.match_tagname, anchor,
+   sizeof(rio.rule.match_tagname));
+   if (strlen(rdr->conf.tag))
+   (void)strlcpy(rio.rule.tagname, rdr->conf.tag,
+   sizeof(rio.rule.tagname));
+
+   rio.rule.nat.addr.type = PF_ADDR_NONE;
+   rio.rule.rdr.addr.type = PF_ADDR_TABLE;
+   if (strlen(t->conf.ifname))
+   (void)strlcpy(rio.rule.rdr.ifname, t->conf.ifname,
+   sizeof(rio.rule.rdr.ifname));
+   if (strlcpy(rio.rule.rdr.addr.v.tblname, rdr->conf.name,
+   sizeof(rio.rule.rdr.addr.v.tblname)) >=
+   sizeof(rio.rule.rdr.addr.v.tblname))
+   fatal("sync_ruleset: table name too long");
+
+   if (rdr->table->conf.flags & F_PORT) {
+   rio.rule.rdr.proxy_port[0] =
+   ntohs(rdr->table->conf.port);
+   rio.rule.rdr.port_op = PF_OP_EQ;
+   }
+   switch (rdr->conf.mode) {
+   case RELAY_DSTMODE_ROUNDROBIN:
+   rio.rule.rdr.opts = PF_POOL_ROUNDROBIN;
+   

sys/dev/pckbc/pms.c diff

2013-06-28 Thread David Hill
in pms_proc_mouse, wsmouse_input is called with an uninitialized
'dz' variable if the sc->protocol->type is not PMS_STANDARD or
PMS_INTELLI.

Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.43
diff -u -p -r1.43 pms.c
--- pms.c   31 May 2013 19:21:09 -  1.43
+++ pms.c   28 Jun 2013 16:13:02 -
@@ -595,7 +595,7 @@ void
 pms_proc_mouse(struct pms_softc *sc)
 {
u_int buttons;
-   int  dx, dy, dz;
+   int dx, dy, dz;
 
buttons = butmap[sc->packet[0] & PMS_PS2_BUTTONSMASK];
dx = (sc->packet[0] & PMS_PS2_XNEG) ?
@@ -604,11 +604,12 @@ pms_proc_mouse(struct pms_softc *sc)
(int)sc->packet[2] - 256 : sc->packet[2];
 
switch (sc->protocol->type) {
-   case PMS_STANDARD:
-   dz = 0;
-   break;
case PMS_INTELLI:
dz = (signed char)sc->packet[3];
+   break;
+   case PMS_STANDARD:
+   default:
+   dz = 0;
break;
}